Several em(member functions) are available manipulating the I/O i(formatting)
flags. Instead of using the members listed below em(manipulators) are often
available that may directly be inserted into or extracted from streams. The
available members are listed in alphabetical order, but the most important
ones in practice are link(setf)(SETF), link(unsetf)(UNSETF) and
link(width)(WIDTH).

    itemization(
    ithtq(copyfmt)(ios &ios::copyfmt(ios &obj))
        (all format flags of tt(obj) are copied to the current tt(ios)
object. The current tt(ios) object is returned.)
    ithtq(fill)(ios::fill() const)
        (the current i(padding) character is returned. By default, this is the
blank space.)
    itt(ios::fill(char padding)):
        quote(the padding character is redefined, the padding character that
was used before the redefinition is returned. Instead of using this member
function the ti(setfill) em(manipulator) may be inserted directly into an
tt(ostream). Example:
        verb(
cout.fill('0');         // use '0' as padding char
cout << setfill('+');   // use '+' as padding char
        )
        )
    ithtq(flags)(ios::fmtflags ios::flags() const)
        (the current set of flags controlling the format state of the stream
for which the member function is called is returned. To inspect whether a
particular flag was set, use the tt(bit_and) operator. Example:
            verb(
if (cout.flags() & ios::hex)
    cout << "Integral values are printed as hex numbers\n"
        ))
    itt(ios::fmtflags ios::flags(ios::fmtflags flagset)):
       quote(the em(previous) set of flags are returned and the new set of
flags are defined by tt(flagset). Multiple flags are specified using the
tt(bitor) operator. Example:
        verb(
        // change the representation to hexadecimal
cout.flags(ios::hex | cout.flags() & ~ios::dec);
        )
        )
    ithtq(precision)(int ios::precision() const)
        (the number of significant digits used when outputting floating point
values is returned (default: 6).)
    itt(int ios::precision(int signif)):hi(display floating point numbers)
        quote(the number of significant digits to use when outputting real
values is set to tt(signif). The previously used number of significant digits
is returned. If the number of required digits exceeds tt(signif) then the
number is displayed in `scientific' notation (cf. section
ref(FORMATFLAGS)). Manipulator: ti(setprecision). Example:
            verb(
cout.precision(3);          // 3 digits precision
cout << setprecision(3);    // same, using the manipulator

cout << 1.23 << " " << 12.3 << " " << 123.12 << " " << 1234.3 << '\n';
// displays: 1.23 12.3 123 1.23e+03
            )
        )
    ithtq(put_time)(Type std::put_time(std::tm const *tm, char const *fmt))
        (hi(display the time)hi(time: display)The function tt(put_time) can be
used to display (elements of) the current time. Time elements are provided in
a tt(std::tm)ti(tm) object, and the way the time is displayed is defined by
the emi(format string) tt(fmt).

    In the next example tt(put_time) is used to display the current date and
time. Note that tt(put_time) is considered a stream em(manipulator): the
header file tthi(iomanip) must be declared before tt(put_time) can be used:
        verb(
    #include <iostream>
    #include <iomanip>
    #include <ctime>

    int main()
    {
        std::time_t tm {time(0)};
        std::cout << std::put_time(std::localtime(&tm), "%c") << '\n';
    }
    // displays, e.g., Sun Dec 20 15:05:18 2015
        )
    The function tt(put_time), as well as tt(std::localtime) and tt(gmtime) is
described in more detail in section ref(TIME).)
    it() hi(setf)label(SETF)tt(ios::fmtflags ios::setf(ios::fmtflags flags)):
        quote(sets one or more formatting flags (use the tt(bitor)
operator to combine multiple flags). Already set flags are not affected. The
em(previous) set of flags is returned. Instead of using this member function
the manipulator ti(setiosflags) may be used. Examples are provided in the next
section (ref(FORMATFLAGS)).)
    itt(ios::fmtflags ios::setf(ios::fmtflags flags, ios::fmtflags mask)):
            quote(clears all flags mentioned in tt(mask) and sets the flags
specified in tt(flags). The em(previous) set of flags is returned. Some
examples are (but see the next section (ref(FORMATFLAGS)) for a more thorough
discussion):
            verb(
        // left-adjust information in wide fields:
cout.setf(ios::left, ios::adjustfield);

        // display integral values as hexadecimal numbers:
cout.setf(ios::hex, ios::basefield);

        // display floating point values in scientific notation:
cout.setf(ios::scientific, ios::floatfield);
            )
        )
    it() hi(unsetf)label(UNSETF)tt(ios::fmtflags ios::unsetf(fmtflags flags)):
        quote(the specified formatting flags are cleared (leaving the
remaining flags unaltered) and returns the em(previous) set of flags.  A
request to unset an active default flag (e.g., tt(cout.unsetf(ios::dec)))
is ignored. Instead of this member function the manipulator ti(resetiosflags)
may also be used. Example:
        verb(
cout << 12.24;              // displays  12.24
cout << setf(ios::fixed);
cout << 12.24;              // displays  12.240000
cout.unsetf(ios::fixed);    // undo a previous ios::fixed setting.
cout << 12.24;              // displays  12.24
cout << resetiosflags(ios::fixed);  // using manipulator rather
                                    // than unsetf
        )
    )
    it()hi(width)hi(display field width)
        label(WIDTH)tt(int ios::width() const):
        quote(the currently active output field width to use on the next
insertion is returned. The default value is 0, meaning `as many characters as
needed to write the value'.)
    itt(int ios::width(int nchars)):
        quote(the field width of the next insertion operation is set to
tt(nchars), returning the previously used field width. This setting is not
persistent. It is reset to 0 after every insertion operation. Manipulator:
hi(setw)tt(std::setw(int)). Example:
        verb(
cout.width(5);
cout << 12;                     // using 5 chars field width
cout << setw(12) << "hello";    // using 12 chars field width
        )
    )
    )
