In this chapter, we learned how to perform console-based IO, a common system-programming requirement, using C++17. Unlike standard C-style IO functions, such as printf() and scanf(), C++ uses stream-based IO functions, such as std::cout and std::cin. There are many advantages and some disadvantages to using stream-based IO. For example, stream-based IO provides a type-safe mechanism for performing IO, while raw, POSIX-style write() functions can often outperform stream-based IO due to a lack of calls to malloc() and free().
In addition, we looked at stream-based manipulators, which provide stream-based IO with a similar feature set to standard C-style format strings, but without the common instability issues found with the C equivalents. In addition to manipulating the format of numbers and Boolean values, we explored field properties, including width and justification...