Programming in c++ Samples of C++ Data Values int sample values 4578 4578 0 float sample values 95274 95 265 9521E-3 95E-1 95213E2 char sample values B d′
6 Samples of C++ Data Values int sample values 4578 -4578 0 float sample values 95.274 95. .265 9521E-3 -95E-1 95.213E2 char sample values ‘B’ ‘d’ ‘4’ ‘?’ ‘*’
Programming in c++ Integral Types >The data types char, short, int, and long are intended to represent different sizes of integers > The sizes are machine dependent >For one particular machine, we might picture the sizes this way char memory cell short memory cel int memory cell long memory cell 7
7 Integral Types ØThe data types char, short, int, and long are intended to represent different sizes of integers. ØThe sizes are machine dependent. ØFor one particular machine, we might picture the sizes this way. char memory cell short memory cell int memory cell long memory cell
Programming in c++ Integral Types( Cont) >We can also explicitly add the reserved word unsigned to the data type name unsigned int )The unsigned integer value is assumed to be only positive or zero
8 Integral Types(Cont.) ØWe can also explicitly add the reserved word unsigned to the data type name: unsigned int ØThe unsigned integer value is assumed to be only positive or zero
Programming in c++ Scientific Notation 2.7E4 means 2.7x 104= 2.7000 27000.0 2.7E.4 means 27x 10-4= 00027 0.00027
9 Scientific Notation 2.7E4 means 2.7 x 10 4 = 2.7000 = 27000.0 2.7E-4 means 2.7 x 10 - 4 = 0002.7 = 0.00027
Programming in c++ More About Floating Point Values s floating point numbers have an integer part and a fractional part, with a decimal point in between Either the integer part or the fractional part, but not both, may be missing 今 EXAMPLES 18.4 500. 8 127.358 o alternatively, floating point values can have an exponent, as in scientific notation--the number preceding the letter E doesn't need to include a decimal point EXAMPLES 1.84E1 5E2 8E-1 -.127358E3 10
10 More About Floating Point Values v floating point numbers have an integer part and a fractional part, with a decimal point in between. Either the integer part or the fractional part, but not both, may be missing v EXAMPLES 18.4 500. .8 -127.358 v alternatively, floating point values can have an exponent, as in scientific notation--the number preceding the letter E doesn’t need to include a decimal point EXAMPLES 1.84E1 5E2 8E-1 -.127358E3