#include #include #include using namespace std; int main() { int i, j, k; //uninitialized variables ios_base::fmtflags save = cin.flags(); cout << "Input an integer in decimal: "; cin >> i; cout << "In decimal, the integer is " << i << ".\n\n"; cout << "Input two integers in octal; leading 0 optional: "; cin >> oct >> i >> j; cout << "In decimal, the integers are " << i << ", " << j << ".\n\n"; cout << "Input two integers in hexadecimal; leading 0x optional: "; cin >> hex >> i >> j; cout << "In decimal, the integers are " << i << ", " << j << ".\n\n"; cout << "Input an integer in decimal: "; cin >> dec >> i; cout << "In decimal, the integer is " << i << ".\n\n"; cout << "Input 3 integers in any base.\n" "Leading 0 for octal, 0x for hex, are now mandatory: "; cin >> resetiosflags(ios_base::basefield) >> i >> j >> k; cout << "In decimal, the integers are " << i << ", " << j << ", " << k <<".\n"; cin.setf(save, ios_base::basefield); return EXIT_SUCCESS; }