#include #include #include using namespace std; int main() { cout << "Please input an integer to translate: \n"; int n {0}; cin >> n; if(!cin){ cerr << "Input failure \n"; return EXIT_FAILURE; } cout << "In hexadecimal, your number is " << hex << setw(8) << setfill('0') << n << "\n"; for (int i {31}; i >= 0; --i) { const int theBit {(n >> i) & 0x1}; cout << theBit; if (i > 0 && i % 8 == 0) { cout << " "; } } cout << "\n\n"; return EXIT_SUCCESS; }