dec

指定整數變數出現在 Base 10 標記法。

ios_base& dec(
   ios_base& _Str
);

參數

  • _Str
    參考型別 ios_base物件,或是從 ios_base繼承的型別。

傳回值

在 _Str 衍生物件的參考。

備註

根據預設,整數變數以 base 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 程式設計

iostreams 慣例