Arrays Help

The Program objective is this:

Write a program which will use 3 arrays. They will contain a students first name, last name, and Final grade average.
Use a loop to pull in 5 sets of information.
Use a loop to print the information out in reverse order along with the class average of the students.

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
#include <iostream>
#include <string>

using namespace std;

int main()
{
	
	
	
	int index , counter;
	string name[5];
	double stuavg[5];
	double finavg , sum;
	
	
	
	sum = 0;
	for (counter = 0; counter < 5; counter++)
	{
	
	cout << "What is the name of the student?" << endl;
	getline(cin , name[counter]);
	
	cout << "What is their average in the class?" << endl;
	cin >> stuavg[counter];
	sum = sum + stuavg[counter];
	finavg = sum / 5;
	
	}
	cout << endl;
	
	

	cout << "The average of the five students is " << finavg << endl;
	
	return 0;


I've been at it for a couple of hours, and I am simply lost. Any guidance would help tremendously. I'm not asking for it to be done for me...but any steering in the right direction would help a ton. Thanks! :)
Last edited on
I think you are pretty close.
First the assignment says you need 3 arrays for name1,name2 and fga.
Use a loop to load the 3 arrays 5 times.
Use a similar loop to print out the 3 arrays in reverse order and sum the jga's to get the total fga.
Use a separate cout statement to print out the class average total fga/5.
Topic archived. No new replies allowed.