C++ Program to find ASCII value of any Character
In this C++ Programming tutorial we will see a C++ Program to find ASCII value of any Character entered by the user. In this program we will accept one character from user and type-cast it into integer which will give the ASCII value of that character.
C++ Program to find ASCII value of any Character
#include <iostream> using namespace std; int main() { char ascii; cout << "Enter a character: "; cin >> ascii; cout << "Its ascii value is: " << (int) ascii << endl; return 0; }
Output
Enter a character: a
Its ascii value is: 97
Its ascii value is: 97