Share via


fixed

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

ios_base& fixed( 
   ios_base& _Str 
);

Parameters

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

Return Value

A reference to the object from which _Str is derived.

Remarks

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.

Example

// 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;
}
1.1
1.100000e+000
1.1

Requirements

Header: <ios>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions