If… else…, example 1
•
int x = 10;
•
if ( x % 2 == 0 )
•
{
•
cout << “x is even”;
•
}
•
else
•
{
•
cout << “x is odd”;
•
}
•
cout << “, done” << endl;
x is even, done
After today’s class you will have seen all the elements needed to write this program. Basic mathematical operators, the “if” control structure, input and output, the sqrt() function.