... 1.4142 1.41421 1.414214 1.4142136 1.41421356 1.414213562 Precision set by stream manipulator setprecision: 1 1.4 1.41 1.414 1.4142 1.41421 1.414214 1.4142136 1.41421356 1.414213562 

13.6.3 Field Width (width, setw)

The width member function (of classes istream and ostream) 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 field 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 ...

Get C++ How to Program, 10/e now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.