11.6 FORMATTED OUTPUT
In professional programs, we must have formatted output. We cannot fill a tender or prepare a report for CEO in format-free manner. The output must look neat. Readability (a measure of the ease with which a passage or text may be read) must be high. Well the starting point is same “cout” and insertion operator. But we have to do more.
Formatting of output is based on three pillars namely ios functions, ios flags and manipulators.
ios functions
The class ios has many defined functions. Following are such commonly used functions.
- width()
- fill()
- precision()
- setf()
- unsetf()
The last two functions work with ios flags.
ios flags
Class ios has defined sixteen flags. Some of them are grouped together. Others are independent. ...
Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.