What is the opposite of "fixed" in cout?
The opposite of std::fixed is equal to std::scientific .
(You will find a good list of manipulators in this excellent answer .)
Answer: std::defaultfloat in C ++ 11. For this in C ++ 03 you can do
cout.unsetf(std::ios_base::floatfield);
See Really, what is the opposite of โfixedโ? I / O manipulator?
The opposite of std::fixed is equal to std::scientific . It can do for you.
However, if you want to restore more flags or if you need a previous state, instead of the default, you can use the best solutions:
the
std::resetiosflagsallows you to reset certain flags by default;two
ios::flagsfunctions allow you to save and restore the previous values โโof format flags.