#include #include #include using namespace std; int main() { int i = 10; ios_base::fmtflags save = cout.flags(); //Save all the format flags. cout << i << "\n" //Decimal by default: printf("%d", i) << oct << i << "\n" //printf("%o", i); << hex << i << "\n" //printf("%x", i); << dec << i << "\n" //printf("%d", i); << setbase(16) << i << "\n"; //printf("%x", i); cerr.copyfmt(cout); //Copy the entire format of cout into cerr. cout.setf(save, ios_base::basefield); //Restore the base. cout << i << "\n"; //same base as line 11 return EXIT_SUCCESS; }