help with homework please!

Alright, so I am in a college c++ class. I am not very good with coding.. we have a question on the following homework assignment..
Student No. Exam -1 Exam-2 Exam-3 Exam-4 Exam-5
& Name **********************************************************
1. Stella 70 78 90 82 68
2. Charles 46 59 61 70 49
3. Mike 90 88 79 69 92
4. Nichole 89 87 92 93 83
5. Ashden 35 33 44 61 40

a. Display the above matrix using a (m*n) matrix.
b. Display the total score of every student.
Ex: Student .1: Stella (Exam-1+Exam-2+Exam-3+Exam-4+Exam-5)
c. Display the average score of every student and their final grade based on the following chart.
100 – 90 – A+ Grade;80 – 89 – A Grade;70 – 79 – B Grade; 60-69 – C Grade; 50-59 – D Grade, Below 49 – fail;
d. Display the details of the students who got the highest and the lowest score.

so far, I have gotten this and it is working but I have no idea how to do the next steps.. if someone could help me out that would be awesome. we are using for loops but I missed the class where we learned about them and im sorta confused. thanks so much in advance!

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
  #include <iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
	int i;
	cout << "Score report:" << endl;
	cout << "Student no." << setw(10) << "Exam-1" << setw(10) << "Exam-2" << setw(10) <<
		"Exam-3" << setw(10) << "Exam-4" << setw(10) << "Exam-5" << setw(10) << endl;
	cout << "& Name" << endl << "*************************************************************" << endl;
	string names[5] = { "Stella", "Charles", "Mike", "Nichole", "Ashden" };
	double exam1[5] = { 70, 46, 90, 89, 35 };
	double exam2[5] = { 78, 59, 88, 87, 33 };
	double exam3[5] = { 90, 61, 79, 92, 44 };
	double exam4[5] = { 82, 70, 69, 93, 61 };
	double exam5[5] = { 68, 49, 92, 83, 40 };
	for (i = 0; i < 5; i++)
	{
		cout << names[i] << "\t\t" << exam1[i] << setw(10) << exam2[i] << setw(10) << exam3[i] << setw(10) << exam4[i] 
			<< setw(10) << exam5[i] << endl;
	}
	int total[5];
	double average[5];
	string grades[5];
	for (i = 0; i < 5;i++)
	{
		total[i] = exam1[i] + exam2[i] + exam3[i] + exam4[i] + exam5[i];
		average[i] = total[i] / 5;
	
	
		cout << names[i] << total[i] << average[i] << endl;
	}
		return 0;
}
That's pretty good so far!

Here's a quick primer on for loops:
1
2
3
for (start; test; step) {
    statements;
}

is identical to:
1
2
3
4
5
6
7
{
    start;
    while (test) {
        statements;
        step;
    }
}

You have everything but the last 2 steps. I suggest that you write a function to compute the letter grade from the average score:
string letterGrade(double score);
Then line 32 can compute and print the letter score in one shot:
cout << names[i] << total[i] << average[i] << letterGrade(avverage[i]) << endl;

For the last step, write a for() loop to get the INDEX (0-4) of the student with the highest grade. Add code to also get the index for of the student with the lowest grade. Then, after the loop, you can print the details of these two students.
Topic archived. No new replies allowed.