Practice exercise -- Data types and values
Categories of simple data types(scalars):
Integral (int):
A data type for integers, or numbers without a decimal point.
Examples are 0, 127, -2147483648, +32767 (+ sign not required)
Floating-point (double, float, short):
A data type for decimal numbers.
Examples are: 0.0, 2.54, -3.21, 1.23E2 -4.56E0, 7.89E-1
Boolean (bool): this logical type is treated as an integral type in C++.
Possible values are true, false.
Character(char):
The smallest integral type, and is used to represent a single character.
For example: 'A', '$', '\t' (means tab--the backslash is termed an "escape"
symbol).
For the value in the left column, place a check under the corresponding data
type column:
Value Integral Floating Boolean Character (invalid)
---------- -------- ----------- ------- --------- ---------
-32768
3.14
false
'\n'
True
0 (zero)
O ("oh")
3.14E0
7.8F1
true
\t
' ' (space)
Define identifers for:
1. a type int variable named celsiusFreezing initialized to 0;
2. a double named pi equal to 3.14;
3. a boolean named done initialized to false; and
4. type char variables named space with value ' '; and newLine = '\n'.