[求助]C++程序不能运行?请指教
#include <iostream.h>
#include <iomanip.h>
int main ()
{
int total, gradeCounter, grade, max;
float average;
total = 0;
gradeCounter = 1;
/* cout << "Enter the max number of the students:";
cin >> max; */
while ( grade >=0 )
{
cout << gradeCounter <<" Enter grade: ";
cin >> grade;
total = total + grade;
gradeCounter ++;
}
if ( gradeCounter != 0 )
{
average = static_cast<float>(total) / gradeCounter;
cout << "The class average is: " << setprecision( 2 )
<< setiosflags ( ios::fixed | ios ::showpoint )
<< average << endl;
}
else cout << "No grades were entered" <<endl;
return 0;
}
运行是总是提示static_cast<float>错误,不知道怎么回事,请指教