Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

scientific

 

Causes floating-point numbers to be displayed using scientific notation.


      ios
      _
      base& scientific(
   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, fixed notation is in effect for floating-point numbers.

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

Example

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

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

   cout << i << endl;
   cout << scientific << i << endl;
}
100.23
1.002300e+002

Requirements

Header: <ios>

Namespace: std

Show: