C++ requires a type specifier for all declarations -
i getting error "c++ requires type specifier declarations" on "const max = 10;" line.
here code:
//a program adds maximum of 10 numbers ( 1,2,3,4,5,6,7,8,9,10 ) #include <iostream> #include <cmath> using namespace std; const max = 10; //the error here! int main() { int sum, num; sum = 0; num = 1; { sum = sum + num; num++; } while (num <= max); { cout << "sum = "; } return 0; }
as error says, c++ requires type specifier declaration. instance, change const max = 10;
const int max = 10;
.
Comments
Post a Comment