C++: Manipulators
Manipulators
Formatting data of the stream using ios member functions is a tedious job. The actions of these functions can be more easily performed using manipulators. When we use manipulators the formatting instructions are directly inserted into a stream. Manipulators can be classified into two categories, those accepting parameters (provided in 'iomanip.h') and others which do not (provided in 'iostream.h'). The following list shows all the of the manipulators.
| Manipulator |
Purpose |
|---|---|
| skipws | Skip white space on input |
| noskipws | Do not skip white space on input |
| dec | Convert to decimal |
| oct | Convert to octal |
| hex | Convert to hexadecimal |
| left | Left align, pad on right |
| right | Right align, pad on left |
| internal | Use padding between sign or base indicator and value |
| end1 | Insert newline and flush the output stream |
| showpos | Shows plus sign for positive values |
To be continued...




Comments
Log in or create a user account to comment.