Export (0) Print
Expand All


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

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

Namespace: std

© 2014 Microsoft