Review Questions
-
Why does C++ have more than one integer type?
-
Declare variables matching the following descriptions:
-
A short integer with the value 80
-
An unsigned int integer with the value 42,110
-
An integer with the value 3,000,000,000
-
What safeguards does C++ provide to keep you from exceeding the limits of an integer type?
-
What is the distinction between 33L and 33?
-
Consider the two C++ statements that follow:
-
How could you use C++ to find out which character the code 88 represents? Come up with at least two ways.
-
Assigning a long value to a float can result in a rounding error. What about assigning long to double?
-
Evaluate the following expressions as C++ would:
-
8 * 9 + 2
-
6 * 3 / 4
-
3 / 4 * 6
-
6.0 * 3 / 4
-
15 % 4
-
Suppose x1 and x2 are two type double variables that you want to add as integers and assign to an integer variable. Construct a C++ statement for doing so.
char grade = 65; char grade = 'A';
Are they equivalent?