-
Code showing error
In the time of compiling, this code is giving some error -
Code:
void printNumberIfEven(int num)
{
if (num % 2 == 1)
{
cout << "odd number" << endl;
return;
}
cout << "number is " << num << endl;
}
int main()
{
int x = 4;
printNumberIfEven(x);
// number is 3
int y = 5;
printNumberIfEven(y);
// odd number
}
Like -
error C2065: 'cout' : undeclared identifier
error C2297: '<<' : illegal, right operand has type 'char [11]'
error C2065: 'endl' : undeclared identifier
error C2297: '<<' : illegal, right operand has type 'char [11]'
-
-
What include file have you included? How are you scoping the std namespace?
Jim
-
Ohh thanks . Now,I get it :)
-
You forget that the library where the program?
Sorry my english is very bad.
-
cauberong09 @ it is solved now :)