I'm having trouble incorporating this for loop:

Into this one:Code:double sum; for (int row= 0; row < i; row ++) { cout << Names[row] << " "; int col=0; for (col= 0; col < num; col ++) cout << Scores[row][col] << " "; cout << "\n"; }

I tried this:Code:cout << fixed << showpoint << setprecision (2); 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'; cout << "* " << AvgStudentScore[row] << " " << Grade[row] << "\n"; }

But the final code does not give me the results I am looking for. The average given by the last code is very very strange. Note, that when I have both for loops (first two loops) I do get the correct results (average), however, the results do not show up where they are supposed to be, which is, next to other data that I have in my program.Code:double sum; cout << fixed << showpoint << setprecision (2); for (int row= 0; row < i; row ++) { cout << Names[row] << " "; sum=0; int col=0; for (col= 0; col < num; col ++) cout << Scores[row][col] << " "; sum= sum + Scores[row][col]; cout << "\n"; 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'; cout << "* " << AvgStudentScore[row] << " " << Grade[row] << "\n"; }

Any ideas anyone?