showbase

指示数值的显示标志基。

ios_base& showbase( 
   ios_base& _Str 
);

参数

  • _Str
    引用类型到 ios_base对象,或者从 ios_base继承的类型。

返回值

为_Str 派生的对象的引用。

备注

数字的标记基可以更改与 12 月10 月hex

操控程序有效调用 _Str.setf(ios_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

请参见

参考

iostream 编程

iostreams 约定