What's the opposite of `fixed` in cout?

Moshe picture Moshe · Sep 14, 2011 · Viewed 10.1k times · Source

When using cout, what is the default formatter defined in the <iomanip> header? In other words, once I've set my formatter to fixed using cout << fixed << setPrecision(2), how do I change it back? Or, what am I changing it back to?

Answer

rmp251 picture rmp251 · Sep 27, 2013

The answer is std::defaultfloat in C++11. To achieve this in C++03 you can do

cout.unsetf(std::ios_base::floatfield);

See Really, what's the opposite of "fixed" I/O manipulator?