39. Write an if statement that prints “yes” on the screen if the value stored in the variable number is between 1 and 100,
inclusive (including 1 and 100).
40. Given the following code:
int testScore = 0;
cout << “Enter the test score: “;
cin >> testScore;
Write an if statement that prints “yes” if the test score entered is valid, and “no” if it is not. A valid test score would be in
the range from 0 to 100, inclusive (including 0 and 100).
41. Rewrite the following if statement condition without using the != operator.
if ( number != 50 )
42. Given the following code:
int number = 50;
Write an if statement that prints “yes” and adds one to the number variable, if the value stored in the number variable is
greater than or equal to 50.
43. Given the following code:
char letter = ‘ ‘;
cout << “Enter a letter: “;
cin >> letter;
Rewrite the following if statement without using the toupper function:
if ( toupper(letter) = “X” )
cout << “The letter entered was either x or X” << endl;
44. Given the following code:
int x = 1;
int y = 2;
int z = 3;
What will the result of the condition in the if statement below be? Show your evaluation breakdown.
if ( (x == 2) || (y == 2) || (z == 2) )
45. Given the C++ instructions below, add the necessary instructions to swap the contents of the variables num1 and
num2.
int num1 = 10;
int num2 = 15;
int temp = 0;