summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schroeder <[email protected]>2021-10-29 15:00:35 -0700
committerBenjamin Schroeder <[email protected]>2021-10-29 15:00:35 -0700
commit28b734d7dcea1851baaf9b08af3b1b050bd64903 (patch)
treefb73ce414c0511cbca1732d1fe992f5e9c80a72d
parentChanged name of main cpp file for exercises 10.5-10.6 (diff)
downloadcst116-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
-rw-r--r--CST116F2021-Lab5/CST116F2021-Lab5_10.5-10.6_Schroeder.cpp85
-rw-r--r--RUN_CST1162021_Scores_Schroeder.txt34
2 files changed, 106 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
diff --git a/RUN_CST1162021_Scores_Schroeder.txt b/RUN_CST1162021_Scores_Schroeder.txt
index ff4030e..7808f7e 100644
--- a/RUN_CST1162021_Scores_Schroeder.txt
+++ b/RUN_CST1162021_Scores_Schroeder.txt
@@ -1,3 +1,10 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Lab5 Exercises 10.5, 10.6, 10.7, and 10.8#7 Benjamin Schroeder
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from Exercises 10.5-10.6 Learn By Doing
+
Enter percent score of student:
# 1 of 10 students: 95
# 2 of 10 students: 85
@@ -35,3 +42,30 @@ Enter percent score of student:
C:\Users\Lenovo\Source\Repos\cst116-lab5-BensProgramma\x64\Debug\CST116F2021-Lab5.exe (process 14272) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+RUN from Exercise 10.7 Learn By Doing
+
+
+Enter your first name: Benjamin
+Enter your last name: Schroeder
+Contents of the 'Full Name Array': Schroeder, Benjamin
+
+
+
+C:\Users\Lenovo\Source\Repos\cst116-lab5-BensProgramma\x64\Debug\CST116F2021-Lab5.exe (process 22292) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Run from Exercise 10.8 #7
+
+Comparing the first 6 chars of strings: 'Frank' and 'Franklyn'
+Different
+
+C:\Users\Lenovo\Source\Repos\cst116-lab5-BensProgramma\x64\Debug\CST116F2021-Lab5.exe (process 21936) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .