Summary of Manipulators and Flags

Header file Manipulator Parameter Effect
iostream.h endl None Causes output to start on the next line
iomanip.h setw(n) int Sets the field width to n characters wide
iomanip.h setprecision(n) int Sets floating point precision to n digits
Header file Flag Parameter Effect
use cout.setf( ) to set
iostream.h ios::showpoint None Force decimal point to be displayed
iostream.h ios::fixed None Force the number of decimal places, padding with zeros

Three ways to set multiple flags:

cout.setf(ios::showpoint);
cout.setf(ios::fixed);

cout.setf(ios::showpoint, ios::fixed);

cout.setf(ios::showpoint | ios::fixed);


The best way to learn and understand these is to try them on your own.



Next page
Previous page
Go to Lesson 4 index.