setbase
[manipulator] smanip setbase ( int base ); | <iomanip> |
cplusplus.com |
Set value for basefield
Sets basefield to hex, dec or oct
depending on base parameter.
The basefield in used in certain input and output operations to determine
the numeric base to be used interpreting numeric values.
You must include <iomanip> to use this manipulator.
Parameters.
Return Value.
Unspecified.
This function should only be used as a stream manipulator.
Example.
// setbase example
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
cout << setbase (16);
cout << 100 << endl;
return 0;
}
This code uses setbase manipulator to set hexadecimal as the basefield.
The output of this example is the hexadecimal value of 100, i.e. 64.
See also.
iomanip manipulators