O'Reilly logo

Beginning C++ Programming by Richard Grimes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Outputting floating point numbers

The <ios> library has manipulators that alter how streams handle numbers. By default, the output stream will print floating-point numbers in a decimal format for numbers in the range 0.001 to 100000, and for numbers outside this range it will use a scientific format with a mantissa and exponent. This mixed format is the default behavior of the defaultfloat manipulator. If you always want to use scientific notation, then you should insert the scientific manipulator into the output stream. If you want to display floating point numbers using just the decimal format (that is the whole number on the left side of a decimal point and the factional part on the right side), then modify the output stream with the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required