Partilhar via


scientific

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

ios_base& scientific(
   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

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

See Also

Reference

iostream Programming

iostreams Conventions

Other Resources

<ios> Members