fork(8) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. cout<<"Text to ASCII converter"<<endl<<"Enter text to convert into ASCII - ";
  7. char text; //defining input type, which is single character
  8. int ascee; //defining that ASCII code will be numeric integer
  9. cin>>text; //taking input from user
  10. ascee = static_cast<int>(text);//converting the input character into ASCII code
  11. cout<<endl<<"ASCII code is "<<ascee<<endl; //displaying the ASCII code
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
Text to ASCII converter
Enter text to convert into ASCII - 
ASCII code is -73