showbase
Gibt die notational Basis an, in der eine Zahl angezeigt wird.
ios_base& showbase(
ios_base& _Str
);
Parameter
- _Str
Ein Verweis auf ein Objekt des Typs ios_base oder ein Typ, der von ios_base erbt.
Rückgabewert
Ein Verweis auf das Objekt, aus dem _Str abgeleitet wird.
Hinweise
Die notational Basis einer Zahl kann mit Dezember, Okt oder Hexadezimal geändert werden.
Der Manipulator ruft effektiv _Str.setf(ios_base::showbase) und gibt dann _Str zurück.
Beispiel
// 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;
}
Anforderungen
Header: <IOS>
Namespace: std