want to calculate all score average

hi, I already get the score average but now I want to calculate all the score average of the students but I'm stuck at it




#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int numStudents, numtests,test, sum, average;
double total, score;


cout << fixed << showpoint << setprecision(1);

cout << "How many students are in your class?:";
cin >> numStudents;

if (numStudents < 0)
{
cout << "Invalid number of students, try again." << endl;
cout << "How many students are in your class?:\n";
cin >> numStudents;
}
cout << "How many tests in this class? :";
cin >> numtests;

if (numtests < 0)
{
cout << "Invalid number of tests, try again." << endl;
cout << "How many tests in this class? :";
cin >> numtests;
}

cout << "\nOk, let's begin. . .\n" << endl;

for (int student = 1; student <= numStudents; student++)
{
cout << "**** students #" << student << "****" << endl;
total = 0;
for (int test = 1; test <= numtests; test++)
{

cout << "Enter score " << test << " for ";
cout << "student " << student << ": ";
cin >> score;
total += score;

if (score < 0)
{
cout << "Invalid score, try again." << endl;
cout << "Enter score " << test << " for ";
cout << "student " << student << ": ";
cin >> score;
total += score;

}

}
sum = total / numtests;
cout << "Average score for student " << student;
cout << " is " << sum << ".\n\n" << endl;


}

average = sum / numStudents;
cout << "Average score for all students is : " << average;





return 0;
}
its just more of the same.
total up all the students' averages and divide by number of students.
(you can do it other ways, but since you have their averages, that is the cleanest).
okay i got it tq
Topic archived. No new replies allowed.