#include <iostream>
#include <iomanip>
int main() {
float a = 456.123456789;
std::cout << a << "\n"; //State 1
std::cout << "fixed " << fixed << a << "\n"; //State 2
std::cout << a << "\n"; //State 3
}
Output:
456.123 //State 1
fixed 456.123444 //State 2
456.123444 //State 3
What I want to do is switch back to state 1, so how can I do that? I tried a couple of things based on http://www.cplusplus.com/reference/iomanip/setprecision/ and all failed.