I've got this assignement and i dont really understand the question: Suppose there are 100 students in a class. You are asked to write a program that can accept the input of the students’ marks from the keyboard and calculate the class average and display it on the screen. Note that each mark is between 0 and 100.
That's where i got so far:
Code:
#include <iostream>
using namespace std;
int main()
{
double avg;
int i,a,sum=0;
for (int i = 0; i< 100; i++)
{
cout <<" Enter a mark:";
cin >> a;
while (a <0 || a >100)
cout <<"Error";
cin >> a;
}
{
sum = sum +a ;
}
avg = sum / 100.0;
cout <<" The avg of the class is: " << avg <<endl;
}
}
Thanks for the help