Iomanip
From Wikipedia, the free encyclopedia
- The correct title of this article is iomanip. The initial letter is shown capitalized due to technical restrictions.
C++ Standard Library |
---|
ios |
iostream |
iomanip |
map |
fstream |
C Standard Library |
cassert |
cctype |
cerrno |
cfloat |
cmath |
cstdio |
cstdlib |
ctime |
<iomanip> is part of the standard C++ input/output library.
Member functions:
setiosflags (ios_base::fmtflags mask) | Sets the format flags specified by n. Setting remains in effect until the next change,
like ios::setf ( ). |
resetiosflags (ios_base::fmtflags mask) | Clears the format flags specified by n. Setting remains in effect until the next change,
like ios::unsetf ( ). |
setbase (int base) | Sets the base in which to display. Valid bases are 2, 8, 10, and 16. |
setw (int n) | Minimum number of characters for next output |
setfill (int c) | Character used to fill with in the case that the width needs to be elongated to fill the minimum. |
setprecision (int n) | Sets precision for decimal numbers, not including integers. Note: This sets the precision for the whole number, not simply after the decimal point. Thus, setting a precision of two for the number 23456.8 will yield 2.3e+004. |
Example:
cout<<setw(10)<<"ten"<<"four"<<"four";