Write a program that reads a positive integer(character code) from the keyboard.
Display the number and the character code as a decimal, an octal, and a hexadecimal on screen.
#include <iostream> #include <iomanip> // Manipulator setw() using namespace std; int main() //from w w w . ja v a2s . c o m { unsigned char c = 0; unsigned int code = 0; cout << "\nPlease enter a decimal character code: "; cin >> code; c = code; // Save for output cout << "\nThe corresponding character: " << c << endl; code = c; cout << "\nCharacter codes" << "\n decimal: " << setw(3) << dec << code << "\n octal: " << setw(3) << oct << code << "\n hexadecimal: " << setw(3) << hex << code << endl; return 0; }