APPENDIX D: FLAGS AND MANIPULATORS

Table D.1 summarizes various manipulators. It may be recalled that to use parameterized manipulators, we have to include file “iomanip.h”.

 

Table D.1 Manipulators from TURBO C++ 3.0

Manipulator Purpose/what it does
dec Converts to decimal
oct Converts to octal
hex Converts to hex
endl Inserts newline and flushes the output stream
ends Inserts null character to terminate and output string
Flush Flushes the output stream
setw(int n) Changes the field width for output to n
setfill(char n) Changes the fill character to n( default character is space)
setprecision(int n) Changes the precision to n places after the decimal point
setbase( base n) Output sets the base to 8,10 or 16
setiosflags ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.