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.
#include <iostream>
#include <string>
usingnamespace 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! :)
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.