C++ Program to Print ASCII Value of Given Char


#include
#include

int main()
{
int one_char;
cout << "\nEnter a character: ";
one_char = getch();
cout << "\nThe character you entered was "
<< (char) one_char << '\n';
cout << " Its ASCII value is "<< (int) one_char << '\n';

return 0;
}




1 comment: