independent flags | boolalpha | read/write bool elements as alphabetic strings (true and false ). |
showbase | write integral values preceded by their corresponding numeric base prefix. | |
showpoint | write floating-point values including always the decimal point. | |
showpos | write non-negative numerical values preceded by a plus sign (+). | |
skipws | skip leading whitespaces on certain input operations. | |
unitbuf | flush output after each inserting operation. | |
uppercase | write uppercase letters replacing lowercase letters in certain insertion operations. | |
numerical base (basefield) |
dec | read/write integral values using decimal base format. |
hex | read/write integral values using hexadecimal base format. | |
oct | read/write integral values using octal base format. | |
float format (floatfield) |
fixed | write floating point values in fixed-point notation. ---------usually used 将浮点数用定点数表示 |
scientific | write floating-point values in scientific notation. 科学计数法 | |
adjustment (adjustfield) |
internal | the output is padded to the field width by inserting fill characters at a specified internal point. 特定处补零 |
left | the output is padded to the field width appending fill characters at the end. 结束补零 | |
right | the output is padded to the field width by inserting fill characters at the beginning. 开头补零 |
std::cout.setf ( std::ios::showbase ); 带0x 等前缀。