showbase
Indicates the notational base in which a number is displayed.
ios_base& showbase(
ios_base& _Str
);
매개 변수
- _Str
A reference to an object of type ios_base, or to a type that inherits from ios_base.
반환 값
A reference to the object from which _Str is derived.
설명
The notational base of a number can be changed with dec, oct, or hex.
The manipulator effectively calls _Str.setf(ios_base::showbase), and then returns _Str.
예제
// ios_showbase.cpp
// compile with: /EHsc
#include <iostream>
int main( )
{
using namespace std;
int j = 100;
cout << showbase << j << endl; // dec is default
cout << hex << j << showbase << endl;
cout << oct << j << showbase << endl;
cout << dec << j << noshowbase << endl;
cout << hex << j << noshowbase << endl;
cout << oct << j << noshowbase << endl;
}
요구 사항
Header: <ios>
네임스페이스: std