Share via


showbase

数字の表示される数の基数を示します。

ios_base& showbase(
   ios_base& _Str
);

パラメーター

  • _Str
    ios_baseオブジェクト、または ios_baseから型への参照。

戻り値

_Str が派生したオブジェクトへの参照。

解説

数値の数の基準は 12 年[10月]、または [16 進]に変更できます。

マニピュレーターは、_Str.setfios_base::showbase () を呼び出し、_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;
}
  

必要条件

ヘッダー: <ios>

名前空間: std

参照

関連項目

入出力ストリームのプログラミング

入出力ストリームの規則