Yes, I have the code to calculate the average. So far it looks like this:
Code:
double sum;
for (int row =0; row < i; row++) //For each student, calculate the average score. Average for each row.
{
sum= 0;
for (int col =0; col < num; col++)
sum= sum + Scores[row][col];
AvgStudentScore[row]= (float) sum/num;
if (AvgStudentScore [row] > 90)
Grade[row]= 'A';
else if (AvgStudentScore [row] > 80)
Grade[row]= 'B';
else if (AvgStudentScore [row] > 67.5)
Grade[row]= 'C';
else if (AvgStudentScore [row] > 55)
Grade[row]= 'D';
else
Grade[row]= 'F';
}
I can have 2-7 numbers of scores. This particular example has 4, but I have to write the code so that it is able to some me score #1, #2, #3-#7. Can I used a for loop for this as well?
ALSO, I'm having trouble with this part:
Code:
AvgStudentScore[row]= (float) sum/num;
Since I'm supposed to store the average (sum being double and num being int) into a float array (AvgStudentScore[])
How can I convert the calculation to a float?