-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradeCalculator.cpp
More file actions
67 lines (61 loc) · 1.82 KB
/
GradeCalculator.cpp
File metadata and controls
67 lines (61 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//CSC114-651
//Student: Christopher Yonek (700642859)
//Assignment: This will calculate the grades of various students.
//Date: September 2018
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int num_Names = 4, num_Tests = 3;
string names[num_Names];
char Grades[5] = { 'A','B','C','D','F' };
double test_score1[num_Names][num_Tests];
int average[num_Tests], studentID[num_Names];
for (size_t i = 0; i < num_Names; i++)
{
cout << "Enter the students name\n";
cin >> names[i];
cout << "Enter the student's ID\n";
cin >> studentID[i];
for (int count = 0; test_score1[count] < 0; cout << "yay";)
{
cout << "Enter the first test score\n";
cin >> test_score1[i][0];
cout << "Enter the 2nd test score\n";
cin >> test_score1[i][1];
cout << "Enter the 3rd test score\n";
cin >> test_score1[i][2];
cout << "Enter the first 4th score\n";
cin >> test_score1[i][3];
average[i] = (test_score1[i][0] + test_score1[i][1] + test_score1[i][2] + test_score1[i][3]) / 4;
}
for (size_t i = 0; i < num_Names; i++) {
cout << "Name: " << names[i] << endl;
cout << "Student ID: " << studentID[i] << endl;
cout << "Average Test Score: " << average[i] << endl;
if (average[i] <= 100 && average[i] >= 91)
{
cout << "Course Grade: " << Grades[0] << endl;
}
if (average[i] <= 90 && average[i] >= 81)
{
cout << "Course Grade: " << Grades[1] << endl;
}
if (average[i] <= 80 && average[i] >= 71)
{
cout << "Course Grade: " << Grades[2] << endl;
}
if (average[i] <= 70 && average[i] >= 61)
{
cout << "Course Grade: " << Grades[3] << endl;
}
if (average[i] <= 60 && average[i] >= 0)
{
cout << "Course Grade: " << Grades[4] << endl;
}
cout << endl;
}
return 0;
}