summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBensProgramma <[email protected]>2021-11-02 15:59:50 -0700
committerGitHub <[email protected]>2021-11-02 15:59:50 -0700
commitea055444c30b8a2333cbaa4873e22fe8ddfa48cf (patch)
treec3b0cdc95629e10213005f765ee4ee3aae7c4f18
parentUpdate RUN_CST1162021_Scores_Schroeder.txt (diff)
downloadcst116-lab5-bensprogramma-ea055444c30b8a2333cbaa4873e22fe8ddfa48cf.tar.xz
cst116-lab5-bensprogramma-ea055444c30b8a2333cbaa4873e22fe8ddfa48cf.zip
Add files via upload
-rw-r--r--CST116F2021-Lab5/RUN_CST1162021_Lab5Exercises_Schroeder.txt255
1 files changed, 255 insertions, 0 deletions
diff --git a/CST116F2021-Lab5/RUN_CST1162021_Lab5Exercises_Schroeder.txt b/CST116F2021-Lab5/RUN_CST1162021_Lab5Exercises_Schroeder.txt
new file mode 100644
index 0000000..507443b
--- /dev/null
+++ b/CST116F2021-Lab5/RUN_CST1162021_Lab5Exercises_Schroeder.txt
@@ -0,0 +1,255 @@
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Lab5 Exercises 10.5, 10.6, 10.7, and 10.8#7 Benjamin Schroeder
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Exercise 10.6 and 10.7
+//HEADER FILE "Scores.h" /////////////////////////////////////////////////////////////////////
+#pragma once
+
+#include <iostream>
+using namespace std;
+
+const int NUM_SCORES = 1;
+const int NUM_STUDENT = 10;
+
+void ReadScores(float[]);
+void LetterG(char[], float[], int[]);
+void average(float[]);
+void displayG(float[], char[], int[]);
+
+void TenSix(); // 10.6 program function
+void TenSeven(); //10.7 program function
+void TenEight_Seven(); // 10.8_7 Program function
+
+//
+
+
+
+
+//FUNCTIONS FILE "ScoresFunctions.cpp" ///////////////////////////////////////////////////////////
+
+
+ for (int i = 0; i < NUM_STUDENT; i++)
+ {
+ if (testScore[i] >= 92.0)
+ {
+ letterGrade[i] = 'A';
+ gradeCounts[0] = gradeCounts[0] + 1;
+ }
+
+ else if (testScore[i] >= 84.0 && testScore[i] < 92.0)
+ {
+ letterGrade[i] = 'B';
+
+#include "Lab5Exercises.h"
+
+
+void ReadScores(float testScore[])
+{
+ cout << "Enter percent score of student: \n";
+
+ for (int i = 0; i < NUM_STUDENT; i++) // starting at 0, array numbered 0 to 9
+ {
+ cout << " \t# " << i + 1 << " of " << NUM_STUDENT << " students:\t";
+ cin >> testScore[i];
+ }
+}
+void LetterG(char letterGrade[], float testScore[], int gradeCounts[])
+{
+
+gradeCounts[1] = gradeCounts[1] + 1;
+ }
+
+ else if (testScore[i] >= 75.0 && testScore[i] < 84.0)
+ {
+ letterGrade[i] = 'C';
+ gradeCounts[2] = gradeCounts[2] + 1;
+ }
+
+ else if (testScore[i] >= 65.0 && testScore[i] < 75.0)
+ {
+ letterGrade[i] = 'D';
+ gradeCounts[3] = gradeCounts[3] + 1;
+ }
+
+ else if (testScore[i] < 65.0)
+ {
+ letterGrade[i] = 'F';
+ gradeCounts[4] = gradeCounts[4] + 1;
+ }
+ }
+}
+
+void average(float testScore[])
+{
+ float average = 0.0;
+ float total = 0.0;
+ for (int i = 0; i < NUM_STUDENT; i++)
+ {
+ total = total + testScore[i];
+ }
+
+ average = total / NUM_STUDENT;
+ cout << "\n\n\tClass Average: " << average << "%\n\n";
+ return;
+}
+void displayG(float testScore[], char letterGrade[], int gradeCounts[])
+{
+ for (int i = 0; i < NUM_STUDENT; i++)
+ {
+ cout << " Student # " << i + 1 << ",\tScore: " << testScore[i] << ", Letter Grade: " << letterGrade[i] << "\n";
+ }
+
+ cout << "\n\tThere were " << gradeCounts[0] << " A's\n";
+ cout << "\tThere were " << gradeCounts[1] << " B's\n";
+ cout << "\tThere were " << gradeCounts[2] << " C's\n";
+ cout << "\tThere were " << gradeCounts[3] << " D's\n";
+ cout << "\tThere were " << gradeCounts[4] << " F's\n";
+
+}
+
+
+
+
+void TenSix()
+ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // p247 10.5 and 10.6 Learn by doing exercises
+
+ {
+ 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);
+
+ }
+
+ void TenSeven()
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // p260 10.7 Learn by doing exercise
+ {
+ 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<< "\n\n";
+ }
+
+
+ void TenEight_Seven()
+ {
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Exercise 10.8 #7 p273
+
+ char string_1[] = "Frank";
+ char string_2[] = "Franklyn";
+
+
+ int differnt = 0;
+
+ for (int i = 0; i < 6; i++)
+ if (string_1[i] != string_2[i])
+ differnt = differnt + 1;
+ if (differnt > 0)
+ cout << "Different\n";
+ else
+ cout << "Same\n";
+
+ }
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ ///////
+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
+ # 3 of 10 students: 75
+ # 4 of 10 students: 86
+ # 5 of 10 students: 89
+ # 6 of 10 students: 91
+ # 7 of 10 students: 81
+ # 8 of 10 students: 72
+ # 9 of 10 students: 52
+ # 10 of 10 students: 93
+
+
+ Student # 1, Score: 95, Letter Grade: A
+ Student # 2, Score: 85, Letter Grade: B
+ Student # 3, Score: 75, Letter Grade: C
+ Student # 4, Score: 86, Letter Grade: B
+ Student # 5, Score: 89, Letter Grade: B
+ Student # 6, Score: 91, Letter Grade: B
+ Student # 7, Score: 81, Letter Grade: C
+ Student # 8, Score: 72, Letter Grade: D
+ Student # 9, Score: 52, Letter Grade: F
+ Student # 10, Score: 93, Letter Grade: A
+
+ There were 2 A's
+ There were 4 B's
+ There were 2 C's
+ There were 1 D's
+ There were 1 F's
+
+
+ Class Average: 81.9%
+
+
+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
+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 . . .
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file