Display ASCII Value of a Character
Write a C++ Program to Display ASCII Value of a Character. Here’s simple C++ Program to Find ASCII Value of a Character in C++ Programming Language.
A character variable holds ASCII value (an integer number between 0 and 127) rather than that character itself in C programming. That value is known as ASCII value.
For example, ASCII value of ‘A’ is 65.
What this means is that, if you assign ‘A’ to a character variable, 65 is stored in that variable rather than ‘A’ itself.
Here is source code of the C++ Program to Display ASCII Value of a Character. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
/* C++ Program to Display ASCII Value of a Character */ #include <iostream> using namespace std; int main() { char c; cout << "Enter any Character :: "; cin >> c; cout << "\nThe ASCII Value of Character [ "<< c << " ] is :: " << int(c)<<"\n"; return 0; }
Output : :
/* C++ Program to Display ASCII Value of a Character */ Enter any Character :: C The ASCII Value of Character [ C ] is :: 67 Process returned 0
Above is the source code for C++ Program to Display ASCII Value of a Character which is successfully compiled and run on Windows System.The Output of the program is shown above .
If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.
Thanks for reading the post….
Find out ASCII values are useful. How about using the conveniet convertibility between ASCII value and text and easier handling of numbers. There are 95 characters in the keyboard, and can be used to represent chessboard, Sudoku board, 52 poker game cards and 31 days in the calendar. For example. you use an array to represent 31 numbers: ( 1- 31) Num[1] = “1” and Num[2] = ‘2″ and Num[17] = “A”.. Num[17].copy(char c1,1); n = int(c1[0]) – 48; n = 17; Coding becomes much simpler and easier to understand the codes.