13.6.3. Field Width (width, setw)
The width member function (of base class
ios_base) sets the field width (i.e., the number of character positions in which a value should be output or the maximum number of characters that should be input) and returns the previous width. If values output are narrower than the field width, fill characters are inserted as padding. A value wider than the designated width will not be truncated—the full number will be printed. The
width function with no argument returns the current setting.
Common Programming Error 13.1
The width setting applies only for the next insertion or extraction (i.e., the width setting is ...