showbase/noshowbase
stream manipulator ios_base& showbase ( ios_base& str ); ios_base& noshowbase ( ios_base& str ); | ios_base |
cplusplus.com |
Set/Unset showbase format flag
showbase sets the format flag to represent values with its C++ base format prefix. That is 0x for hexadecimal values, 0 for octal values and no prefix for decimal values.
noshowbase unsets this flag, representing values in its corresponding base without base prefix.
Parameters.
Return Value.
A reference to the stream object.
Example.
// modify showbase flag
#include <iostream>
using namespace std;
int main () {
int n;
n=20;
cout << hex << showbase << n << endl;
cout << hex << noshowbase << n << endl;
return 0;
}
The execution of this example shall display:
0x14
14
See also.
flags,
setf,
unsetf
ios_base class