Question: how do i get the average to come out, correctly. The first avg., should be 85, next second one: 85.5, then student three: 80.
Here's my code:
#include <iostream>
#include <iomanip>
using namespace std;
void handleOneStudent(int N);
int main()
{
int NumberOfStudents;
cout << "How many students are in the class ?" << endl;
cin >> NumberOfStudents;
cout << endl;
for (int i=1; i <= NumberOfStudents; i++)
handleOneStudent(i);
return 0;
}
void handleOneStudent(int N)
{
const int num_quizzes = 5;
int score[num_quizzes];
double average;
cout << setprecision(2)
<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint);
cout << "Enter five test scores for student number " << N << endl;
cin >> score[0];
cin >> score[1];
cin >> score[2];
cin >> score[3];
cin >> score[4];
average = (score[1] + score[2] + score[3] + score[4] + score[5])/5;
cout << endl << endl;
cout << "The average for student number " << N << " is " << average << endl;
}