I have a grade book assignment that I can't for the life of me figure out. I am relatively new at C++ so I'm sure it's not difficult, but I still need help. Here is my assignment:
"Create a grade book program as follows:
1. Ask user to give total number of students;
2. Ask user to enter numerical grade for each student;
3. Print to screen the average, highest and lowest grade;"
The output screen should say:
"How many students in the class?"
Say I enter 5, then it should ask me for the 5 test scores, saying "Enter student 1 numerical grade (0-100):"
and then student 2, student 3, etc.
After I enter the scores, I need the average, the highest score, and the lowest score.
I was able to get up to asking for the test scores, but am struggling with an array that gives me the average and the highest and lowest score. This is more code so far:
1 #include <iostream>
2 #include <cstdlib>
3 using namespace std;
4 int main()
6 int x;
7 int num;
8 int i;
9 int avg;
10 int num;
11 float input, sum=0, avg;
12 cout << "How many people in the class? " ;
13 cin >> x;
14 for(int i = 1; i <= num; i++)
16 cout << "Enter student " << i+1 << " numerical grade (0-100): " << endl;
17 cin >> num;
20 cin >> input;
21 sum += num;
avg = num / x;
24 cout << "The average grade is " << avg << endl;
25 return 0;