IOMANIP
This provides a set of stream manipulators that allow precise control over input and output formatting, particularly for use with cin
and cout
. It includes tools to set field width (setw
), control number precision (setprecision
), align text (left
, right
, internal
), fill empty spaces (setfill
), and format numbers in fixed-point, scientific, or hexadecimal notation (fixed
, scientific
, hexfloat
). These manipulators are especially useful when formatting output for tables, reports, or aligning numerical data. Being part of the C++ Standard Library, <iomanip>
works seamlessly with iostream
and offers a clean, readable way to handle formatting without resorting to lower-level C-style functions like printf()
.
Last updated