summaryrefslogtreecommitdiff
path: root/CST116F2021-Lab5
diff options
context:
space:
mode:
Diffstat (limited to 'CST116F2021-Lab5')
-rw-r--r--CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp85
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