C++ Program to Find ASCII Value

ASCII stands for American Standard Code for Information Interchange. This is a character encoding standard for electronic communications. If you want to learn how to write a program to find the ASCII value of a character, this article is for you. In this article, I will explain how to write a C++ program to find the ASCII value of a character.

C++ Program to Find ASCII Value

ASCII encodes 128 specified characters into seven-bit integers. Out of them, 95 characters are printable including:

  1. digits between 0 to 9
  2. lowercase letters a to z
  3. uppercase letters A to Z
  4. and punctuation symbols

Hope you now understand what ASCII characters contain, here is how to find the ASCII value of a character using C++:

Enter any number : B
The ASCII Character of B is 66

In the above code, I have first introduced a variable as ch1, then I am storing a user input inside the variable, and then I am converting the value of the variable ch1 into an integer which finds the ASCII value of the input character. 

Summary

So this is how to write a C++ program to find the ASCII value of a character. ASCII encodes 128 specified characters into seven-bit integers. Out of them, 95 characters are printable which includes:

  1. digits between 0 to 9
  2. lowercase letters a to z
  3. uppercase letters A to Z
  4. and punctuation symbols

I hope you liked this article on how to write a C++ program to get the ASCII value of a character. Feel free to ask your valuable questions in the comments section below.

Aman Kharwal
Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of data📈.

Articles: 1397

Leave a Reply