This is the code i have so far but i keep getting errors. I need help finding the highest average grade.Code:#include "stdafx.h" #include <iostream> #include <iomanip> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const int numberOfstudents = 8; const int numberOfgrades = 3; double total; double average; string name[numberOfstudents] = {"Isabel", "Steve", "Michael", "James", "Jennifer", "Billy", "Brenda", "Jesus"}; double grades[numberOfstudents][numberOfgrades] = {{92,95,94}, {99,76,68}, {89,70,85}, {80,75,71}, {78,77,93}, {93,91,89}, {82,95,71}, {98,82,84}}; cout << "Student Name Grade\n"; cout << "------------" << setw(14) << "-------\n"; for (int student = 0; student < numberOfgrades; student ++) { total = 0; for (int col = 0; col < numberOfgrades; col++) total += grades[student][col]; average = total / numberOfgrades; cout << setw(9) << left << name[student]; cout << fixed << showpoint << setprecision(2); cout << setw(14) << right << average << endl; } double row; double highestAverage = 0; double topStudent; for( row = 1; row < numberOfstudents ; row++) { if(grades[row] > highestAverage) { highestAverage = grades[row]; topStudent = row; } } { cout <<"\nThe student with the highest average grade is " << name[topStudent] <<" and the average is " << grades[topStudent] << endl; } return 0; }
This is the error i get error C2108: subscript is not of integral type.
Sorry for not posting it earlier.