다음을 통해 공유


dec

Specifies that integer variables appear in base 10 notation.

ios_base& dec( 
   ios_base& _Str 
);

매개 변수

  • _Str
    A reference to an object of type ios_base, or to a type that inherits from ios_base.

반환 값

A reference to the object from which _Str is derived.

설명

By default, integer variables are displayed in base 10.

dec effectively calls _Str.setf(ios_base::dec, ios_base::basefield), and then returns _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;
}
  

요구 사항

Header: <ios>

네임스페이스: std

참고 항목

참조

iostream 프로그래밍

iostreams 규칙