Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::scientific

 

std::scientific is a stream manipulator for real numbers to be displayed in the scientific notation.

 

#include <iostream>

int main()
{
  const double x = 123.456;
  std::cout            << x << '\n'
    << std::fixed      << x << '\n'
    << std::scientific << x << '\n';
}

 

Screen output:

 

123.456
123.456000
1.234560e+02

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict