Turn off scientific notation on float

There are two things found in iomanip that must be included. First is fixed and the second is setprecision

You need to write:

std::cout << fixed;  
std::cout << setprecision(2) << f;

fixed disables the scientific notation i.e. 1.23e+006 and fixed is a sticky manipulator so you need to disable it if you want to revert back to scientific notation.

Leave a Comment