dec

指定整数变量出现在基础10表示形式。

ios_base& dec(
   ios_base& _Str
);

参数

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

返回值

为_Str派生的对象的引用。

备注

默认情况下,整数变量在基础10.显示。

dec 有效调用 _Str.setf(ios_base::dec, ios_base::basefield),然后返回 _Str。

示例

// ios_dec.cpp
// compile with: /EHsc
#include <iostream>

int main( ) 
{
   using namespace std;
   int i = 100;

   cout << i << endl;   // Default is base 10
   cout << hex << i << endl;   
   dec( cout );
   cout << i << endl;
   oct( cout );
   cout << i << endl;
   cout << dec << i << endl;
}
  

要求

标头: <ios>

命名空间: std

请参见

参考

iostream编程

(mfc)约定