diff options
| author | Benjamin Schroeder <[email protected]> | 2021-10-29 15:00:35 -0700 |
|---|---|---|
| committer | Benjamin Schroeder <[email protected]> | 2021-10-29 15:00:35 -0700 |
| commit | 28b734d7dcea1851baaf9b08af3b1b050bd64903 (patch) | |
| tree | fb73ce414c0511cbca1732d1fe992f5e9c80a72d /CST116F2021-Lab5 | |
| parent | Changed name of main cpp file for exercises 10.5-10.6 (diff) | |
| download | cst116-lab5-bensprogramma-28b734d7dcea1851baaf9b08af3b1b050bd64903.tar.xz cst116-lab5-bensprogramma-28b734d7dcea1851baaf9b08af3b1b050bd64903.zip | |
Added exercises 10.7 and 10.8#7 and updated the txt file of the RUNS
Diffstat (limited to 'CST116F2021-Lab5')
| -rw-r--r-- | CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp | 85 |
1 files changed, 72 insertions, 13 deletions
diff --git a/CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp b/CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp index 71d0927..14dc7d7 100644 --- a/CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp +++ b/CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp @@ -1,22 +1,81 @@ // Lab5_Schroeder_TestScores.cpp : This file contains the 'main' function. Program execution begins and ends there. // -//247 10.5 and 10.6 Learn by doing exercises +// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// p247 10.5 and 10.6 Learn by doing exercises // -#include "Scores.h" +//#include "Scores.h" +// +// +//int main() +//{ +// int gradeCounts[5]{ 0 }; +// float testScore[NUM_STUDENT]{ 0.0 }; +// char letterGrade[NUM_STUDENT]{ 'A' }; +// +// +// ReadScores(testScore); +// LetterG(letterGrade, testScore, gradeCounts); +// cout << "\n\n"; +// displayG(testScore, letterGrade, gradeCounts); +// average(testScore); +//} +// -int main() -{ - int gradeCounts[5]{ 0 }; - float testScore[NUM_STUDENT]{ 0.0 }; - char letterGrade[NUM_STUDENT]{ 'A' }; +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// p260 10.7 Learn by doing exercises +//# include<iostream> +//using namespace std; +// +// +// +//int main() +//{ +// char First[41]{}; +// char Last[41]{}; +// char Full[81]{}; +// +// cout << "Enter your first name: "; +// cin.ignore(cin.rdbuf()->in_avail()); +// cin.getline(First, 41); +// cin.clear(); +// cin.ignore(cin.rdbuf()->in_avail()); +// +// +// cout << "Enter your last name: "; +// cin.ignore(cin.rdbuf()->in_avail()); +// cin.getline(Last, 41); +// cin.clear(); +// cin.ignore(cin.rdbuf()->in_avail()); +// +// for (int i = 0; i < strlen(Last); i++) +// Full[i] = Last[i]; +// Full[strlen(Last)] = ','; +// Full[strlen(Last)+1] = ' '; +// for (int j = 0; j <strlen(First); j++) +// Full[strlen(Last)+2+j] = First[j]; +// +// cout <<"Contents of the 'Full Name Array': "<< Full; +//} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Exercise 10.8 #7 - ReadScores(testScore); - LetterG(letterGrade, testScore, gradeCounts); - cout << "\n\n"; - displayG(testScore, letterGrade, gradeCounts); - average(testScore); -} +#include<iostream> +using namespace std; + +char string_1[] = "Frank"; +char string_2[] = "Franklyn"; + +int main() +{ + int compare = strncmp(string_1, string_2, 6); + cout << "Comparing the first 6 chars of strings: '" << string_1 << "' and '" << string_2 << "'"; + if (compare == 0) + cout << "\nSame\n"; + else if (compare < 0) + cout << "\nDifferent\n"; +}
\ No newline at end of file |