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.
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>'.
ios::fill
.
Requires `#include <iomanip.h>'.
Go to the first, previous, next, last section, table of contents.