Cpp Program Find ASCII Value of a Character
In this program, you will learn about printing the value of ASCII of the char variables in the cpp programming language.
Every character on the keyboard of the computer has its own integer number which is called the ASCII value of the character . The range is (between 0 and 127).
For example:
ASCII value of the A is 65.
code:
#include <iostream>
using namespace std;
int main()
{
char ch;
cout<<" enter any one character "<<endl;
cin>>ch;
cout<<" ASCII value of "<<ch<<" is "<<int(ch)<<endl;
return 0;
}
Output:
enter any one character
A
ASCII value of A is 65
Here, printing the integer value of the character by writing int(ch), and print the ASCII value of the character.
Comments
Post a Comment