These manipulators are used with cout along
with the rest of the output varaibles. For example
cout << endl;
ends the line, can be used even after many other
outputs
(cout << "Hi!"
<< endl;)
| Manipulator | Purpose |
| ws | Turn on whitespace skipping on input |
| dec | convert next var to decimal |
| oct | to octal |
| hex | to hexadecimal |
| endl | ends the line (same as \n) |
| ends | insert NULL character |
| flush | updates monitor |
| lock | lock file handle |
| unlock | unlock file handle |
A short explanation of flush: cout.flush() and cout << flush do the same thing. On some compilers, the output is "line buffered," which means nothing is displayed until an endl or flush is reached -- this is to increase text speed. If output needs to be displayed without ending the line, use << flush or cout.flush() command.