previous |
start |
next
Example data type values
Basic types
bool true, false
char Enclosed in single quotes: 'a', 'A', 'x', '0', '('
short Typical range: -32768 to 32767
(e.g., not -32769 and not 32768)
int Typical range: -2147483648 to 2147483647
long Usually same range as int, but might be bigger
float Maximum value usually about 1038
fraction part is 23 bits (for a normalized float)
223 = 8388608. So only about 6 digits can be assumed
to be significant.
double Maximum value usually about 10307
fraction part is 52 bits (for normalized) 252 =
4503599627370496 (16 digits) So only about 15 digits can be
assumed to be significant.
Some class types
string (No direct representation.) "Hello, World!", string("C++").
The double quoted "Hello, World!" will automatically be
converted to type string depending on how it is used.
The second example, string("C++"), explicitly requests conversion to type
string.
istream cin is a predefined input stream
associated by default with input typed on the keyboard. It is of
type istream.
ostream cout is a predefined output
stream associated by default with output going to the
screen or window (character and line based output).
previous |
start |
next