13.6.1. Integral Stream Base: dec, oct, hex and setbase
Integers are interpreted normally as decimal (base-10) values. To change the base in which integers are interpreted on a stream, insert the hex manipulator to set the base to hexadecimal (base 16) or insert the oct manipulator to set the base to octal (base 8). Insert the dec manipulator to reset the stream base to decimal. These are all sticky manipulators.
A stream’s base also may be changed by the setbase stream manipulator, which takes an
int argument of
16 to set the base to decimal, octal or hexadecimal, respectively. Because
setbase takes an argument, it’s called a parameterized stream manipulator. Parameterized stream manipulators like
setbase require the header