May 2012
Intermediate to advanced
679 pages
16h 56m
English
Manipulators are the alternate way of formatting data by setting ios flags. Earlier, we have seen the statements like
cout.setf(ios::hex) ;
cout << marks ;
Now these two actions can be combined in one expression. We can write
cout << hex << marks ;
In this case, hex is a manipulator defined in the header file “iostream.h”. Whatever formatting we can do by setting /unsetting flags can be done with the help of manipulators.
You may ask why an alternative is required for something that is so simple and straightforward. There are two reasons.
Read now
Unlock full access