C++ simple I/O format control

ps: Include the iomanip header file at the beginning of the source program

Commonly used I/O stream library manipulators

-------------------------------------------------------

dec | Decimal representation of numeric data

hex | Numerical data hexadecimal representation

oct | numeric data octal representation

ws | extract whitespace

endl | Insert a newline and flush the stream

ends | Insert a null character

setsprecision(int) | Sets the number of decimal places for floating point numbers

                          | include decimal point

setw(int) | set field width

-------------------------------------------------------

For example:

8c41a26cf9514f74a1b8253fa6a1f840.png

95d695003fc649f2a8de3876282f1855.png 

 

2f969f28ea794cf8b164041e7611863f.png 

2a92b77e2dde4d42a45c0639fe2e6ed0.png 

 

 ----------C++ language study notes----------

Guess you like

Origin blog.csdn.net/m0_57781693/article/details/129779075