• Register
100 points
7 2
Welcome to Kodlogs, programming questions and answer website.

What header file should we include to use stream manipulators?
The answer to the above question is we have to use iomanip to use the stream manipulators. If that's what you are looking for, then you got what you want. Below is the explained reason why we use that header file.

What are manipulators?

In C++ the functions used in conjunction with the insertion (<<) and extraction (>>) operators on stream objects are called manipulators. They are used to change formatting parameters on streams and also for insertion or extraction.
 

What are stream manipulators?

The functions that are used on the right side of the insertion operators are known as stream manipulators. For example setprecision(), setw(), setfill() and many more.
 

Why iomanip is used for stream manipulators?

The answer is pretty simple. We have to include an iomanip header file to the C++ program to use the stream manipulators because that’s the only header file that contains function for stream manipulators like setfill, setw, setioflags and etc.

Hope this will help.
 

100 points
7 2