#include #include #include #include // needed for setw() using namespace std; int main() { double a; a = 123.456; cout << a << endl; cout.setf(ios::scientific); // Sets flag cout << a << endl; cout.unsetf(ios::scientific); // clears flag cout << a << endl; // Always use save/restore instead of set/clear long flagSettings = cout.flags(); // saves flag settings cout.setf(ios::scientific); cout << a << endl; cout.flags(flagSettings); // restore flag settings cout << a << endl; return 0; }