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]'