다음을 통해 공유


fixed

Specifies that a floating-point number is displayed in fixed-decimal notation.

ios_base& fixed( 
   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.

설명

fixed is the default display notation for floating-point numbers. scientific causes floating-point numbers to be displayed using scientific notation.

The manipulator effectively calls _Str.setf(ios_base::fixed, ios_base::floatfield), and then returns _Str.

예제

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

int main( ) 
{
   using namespace std;
   float i = 1.1F;

   cout << i << endl;   // fixed is the default
   cout << scientific << i << endl;
   cout.precision( 1 );
   cout << fixed << i << endl;
}
  

요구 사항

Header: <ios>

네임스페이스: std

참고 항목

참조

iostream 프로그래밍

iostreams 규칙