aboutsummaryrefslogtreecommitdiff
path: root/LAB5-Ansari-Answers.txt
diff options
context:
space:
mode:
author[email protected] <[email protected]>2021-11-02 18:23:00 -0700
committer[email protected] <[email protected]>2021-11-02 18:23:00 -0700
commitc27a2d68f59ac753e04bc2983b6c5ae3acca69b3 (patch)
tree26871e00fdcd6a3c76caed61bbca8dbcef0ea8d6 /LAB5-Ansari-Answers.txt
parentAdd online IDE url (diff)
downloadcst116-lab5-rayyanansari03-c27a2d68f59ac753e04bc2983b6c5ae3acca69b3.tar.xz
cst116-lab5-rayyanansari03-c27a2d68f59ac753e04bc2983b6c5ae3acca69b3.zip
Lab 5 answers V1
Diffstat (limited to 'LAB5-Ansari-Answers.txt')
-rw-r--r--LAB5-Ansari-Answers.txt128
1 files changed, 128 insertions, 0 deletions
diff --git a/LAB5-Ansari-Answers.txt b/LAB5-Ansari-Answers.txt
new file mode 100644
index 0000000..30a5672
--- /dev/null
+++ b/LAB5-Ansari-Answers.txt
@@ -0,0 +1,128 @@
+// LAB5 - ANSARI.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+
+#include <iostream>
+using namespace std;
+const int NUMSTUDENTS = 10;
+const int NUMGRA = 5;
+
+int main()
+{
+ float scoreArray[NUMSTUDENTS] = { 0.0 };
+ string gradeArray[NUMSTUDENTS];
+ int numGradeArray[NUMGRA] = { 0 };
+ float avg = 0.0;
+ for (int i = 0; i < NUMSTUDENTS; i++) {
+
+ cout << "Enter score " << i + 1 << ": " << endl;
+ cin >> scoreArray[i];
+ avg += scoreArray[i];
+
+
+
+ }
+
+ for (int n = 0; n < NUMSTUDENTS; n++) {
+
+ if (scoreArray[n] >= 92) {
+
+ gradeArray[n] = "A";
+ numGradeArray[0] += 1;
+
+ }
+
+ else if (scoreArray[n] >= 84) {
+
+ gradeArray[n] = "B";
+ numGradeArray[1] += 1;
+
+ }
+
+ else if (scoreArray[n] >= 75) {
+
+ gradeArray[n] = "C";
+ numGradeArray[2] += 1;
+
+ }
+ else if (scoreArray[n] >= 65) {
+
+ gradeArray[n] = "D";
+ numGradeArray[3] += 1;
+
+ }
+
+ else {
+
+
+ gradeArray[n] = "F";
+ numGradeArray[4] += 1;
+
+ }
+
+ }
+
+ for (int x = 0; x < 10; x++) {
+
+ cout << scoreArray[x] << " = " << gradeArray[x] << endl;
+
+ }
+
+ cout << "Average is: " << avg / 10 << endl;
+
+ cout << "The amount of people that got an A, B, C, D, and F in order are listed below: " << endl;
+
+ for (int y = 0; y < 5; y++) {
+
+ cout << numGradeArray[y] << endl;
+
+ }
+
+
+}
+
+OUTPUT:
+
+Enter score 1:
+65
+Enter score 2:
+87
+Enter score 3:
+98
+Enter score 4:
+98
+Enter score 5:
+98
+Enter score 6:
+23
+Enter score 7:
+12
+Enter score 8:
+65
+Enter score 9:
+78
+Enter score 10:
+89
+65 = D
+87 = B
+98 = A
+98 = A
+98 = A
+23 = F
+12 = F
+65 = D
+78 = C
+89 = B
+Average is: 71.3
+The amount of people that got an A, B, C, D, and F in order are listed below:
+3
+2
+1
+2
+2
+
+C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 13084) 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 . . .
+
+--------------------------------------------------------------------------------------------------------------
+