Before coming to the lab you should read through Chapter (1) and Chapter (1).
1. Explain what do the following code segments do? Write the exact output as will be displayed by the code segment when it is placed in complete C++ program.
int j = 5;
while( j > 0)
cout << j*j << endl;
2. Explain what is wrong in the following code segments? Correct
the error, then explain what the output would be in the correct segment
is included in a complete C++ program.
int j = 0, i;
char c = 'A', p;
while( j < 5)
p = c + j;
cout << "Your character + " << j << " is " << c+j << " the ASCII value for " << p<< endl;
3. Write a C++ program that ask users to input an integer and does the
1) if the number is less than 0 or greater than 100, display a message that the number is out of range.
2) for all numbers between 0 to 100, display whether it is odd or even. Hint: use the MOD opertor (%) as shown in Lab (3).