I don't know whether this is useful or merely entertaining, but it is quite simple to display the character representation of any ASCII number in C++

We will use the static_cast function to perform this operation, converting from int to char.
Let me show you this sample program that does just that (Looping until you enter 0)

  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int r;
  6. cout < < "Enter a number to see its character: \n" << "Number: ";
  7. cin >> r;
  8. while(r!=0){
  9. cout < < "\nCharacter: " << static_cast<char>(r);
  10. cin.get();
  11. cout < < "\nNumber: ";
  12. cin >> r;
  13. }
  14. return 0;
  15. }</iostream>

As you can see we simply ask for a number, and while that number is not 0 we keep on asking for more, as well as displaying its character representation by using the static_cast function.

Hope you enjoyed this ;)
Alex