Hi,
I have a stuct that includes values of 4 different assighnments completed by 50 students.
I am trying to find the mean value for each of these assighnments and implement this code in a function rather than re-writing the code 4 times.
1 2 3 4 5 6 7 8 9 10
double sum, mean;
for(int i = 0; i < list_size; i++)
{
sum += student[i].ass1;
}
mean = sum / size;
cout << "Mean: " << mean << endl;
This code is from main, I am not sure how to turn it into a universal function that will also serve ass2, ass3 and ass4.