f78 Changing stream properties using manipulators

Contents|Index|Previous|Next

Changing stream properties using manipulators

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 use the following input statement to produce |**234| as output.

cout << "|" << setfill('*') << setw(5) << 234 << "|"; 

Manipulators that take an argument require #include <iomanip.h>.

ws 
Manipulator 
flush 
Manipulator 
endl 
Manipulator 
ends 
Manipulator 
setprecision (int signif) 
Manipulator 
setw (int n) 
Manipulator 
setbase (int base) 
Manipulator 
dec 
Manipulator 
hex 
Manipulator 
oct 
Manipulator 
setfill (char padding) 
Manipulator 
0