0

Hi all,

im am writing a program to take in and store a student's grade as an int.

Can anyone tell me please how do i get the average score of the grade?

This is what i have so far...

Regards.

```
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
const int NUM_STUDENTS=5;
const int NUM_SCORES=6;
int i;
struct Student
{
int number;
float scores[NUM_SCORES];
};
Student studentA, studentB ={333333, {45, 53, 57, 46, 51, 55} },
studentC ={333333, {45, 53, 57, 46, 51, 55} };
cout << "Enter the STUDENTS ID NUMBER: ";
cin >> studentA.number;
cout << "Enter " << NUM_SCORES << " test scores seperated by a space: ";
for (i=0; i <NUM_SCORES; i++)
{
cin >> studentA.scores[i];
}
studentB.number = studentA.number+1;
for (i=0; i<NUM_SCORES; i++)
{
studentB.scores[i]=65;
}
cout << "\n StudentA: number " << studentA.number << " scores: ";
cout << fixed << setprecision(1);
for (i=0; i<NUM_SCORES; i++)
{
cout << setw(5) << studentA.scores[i];
}
cout << "\n StudentB : number " << studentB.number << " scores ";
for (i=0; i<NUM_SCORES; i++)
{
cout << setw(5) << studentB.scores[i];
}
cout << "\n StudentC: number " << studentC.number << " scores ";
for (i=0; i<NUM_SCORES; i++)
{
cout << setw(5) << studentC.scores[i];
}
cout << endl << endl;
return 0;
}
```