For convenience, manipulators provide a way to change certain
properties of streams, or otherwise affect them, in the middle of
expressions involving `<<
' or `>>
'. For example, you might
write
cout << "|" << setfill('*') << setw(5) << 234 << "|";
to produce `|**234|
' as output.
cout << ... <<flush;
'
has the same effect as `cout << ...; cout.flush();
'.
\n
', then flushes the output stream.
\0
' (the string terminator character).
ios::precision
in `<<
'
expressions with the manipulator `setprecision(signif)
'; for
example,
cout << setprecision(2) << 4.567;
prints `4.6
'. Requires #include <iomanip.h>.
ios::width
in `<<
' expressions
with the manipulator `setw(n)
'; for example,
cout << setw(5) << 234;
prints ` 234
' with two leading blanks. Requires #include <iomanip.h>.
10
(decimal), 8
(octal), or
16
(hexadecimal), change the base value for numeric
representations. Requires #include <iomanip.h>.
setbase(10)
'.
setbase(16)
'.
setbase(8)
'.
ios::fill
.
Requires #include <iomanip.h>.