Upload
mayank-makwana
View
221
Download
0
Embed Size (px)
Citation preview
8/12/2019 Formatting Integers c Plus Plus
http://slidepdf.com/reader/full/formatting-integers-c-plus-plus 1/2
C++
#i ncl ude <i omani p>
cout << set i osf l ags( i os: : r i ght ) ;
setw
cout << set w( 10) << 100 << set w( 10) << 50 << set w( 10) << 25;
*******100********50********25
*
C++
set w
cout << set i osf l ags( i os : : f i xed | i os : : showpoi nt | i os : : r i ght )<< setpr eci si on( 2 ) ;
cout << set w( 8 ) << 123. 45;
* * 123. 45
8/12/2019 Formatting Integers c Plus Plus
http://slidepdf.com/reader/full/formatting-integers-c-plus-plus 2/2
set i os f l ags ( i os : : f i xed | i os : : showpoi nt | i os : : r i ght )
set i osf l ags
set i osf l ags( <f l ag1> | <f l ag2> | … | <f l agn> )
i os : : showpoi nt
i os : : f i xed
i os : : sci ent i f i c
i os : : r i ght
Set pr eci si on
Set pr eci si on
C++
a. 173. 0b. 12345678. 9c. - 0. 0000012d. +014. 768e. - 5. 2
a. - 1. 0046E+3b. 4. 2E- 8c. 9. 020E10d. - 4. 615230E3e. 8. 02E- 3