write a statement that sets leftPage to TRUE if pageNumber is even. (Hint: Consider what the remainders are when you divide different integers by two.)
5. Write an If statement (or a series of If statements) that assigns to the variable biggest the greatest value contained in variables i, j, and k. Assume the three values are distinct.
6. Rewrite the following sequence of If-Thens as a single If-Then-Else.
if (year % 4 == 0)
cout << year < is a leap year. << endl;
if (year % 4 != 0)
{
year = year + 4 - year % 4;
cout << year < is the next leap year. << endl;
}
7. Simplify the following program segment, taking out unnecessary comparisons. Assume that age is an int variable.
if (age > 64)
cout << Senior voter;
if (age < 18)
cout << Under age;
if (age >= 18 && age < 65)
cout << Regular voter;
8. The following program fragment is supposed to print out the values 25, 60, and 8, in that order. Instead, it prints out 50, 60, and 4. Why?
9. The following C++ program segment is almost unreadable because of the inconsistent indentation and the random placement of left and right braces. Fix the indentation and align the braces properly.
// This is a nonsense program
if (a > 0)
if (a < 20)
{
cout << A is in range. << endl;
b = 5;
}
else