C++ Program to Display the ASCII Value of the Character Entered


This is a C++ Program to Display the ASCII Value of the Character Entered.
Problem Description
The program takes a character and prints its ASCII value. ASCII stands for American Standard Code for Information Interchange which is a numerical representation of characters in computers ranging from 0 to 127.
Problem Solution
1. A character is entered.
2. The equivalent ASCII value of the character is printed.
3. Exit.
C++ Program/Source code
Here is the source code of C++ Program to Display the ASCII Value of the Character Entered. The program output is shown below.
#include<iostream>
using namespace std;

int main()
{
 char ch;
 cout<<"\nEnter any character : ";
 cin>>ch;
 cout<<"ASCII equivalent is : "<<static_cast<int>(ch);
 
 
 return 0;
}

Post a Comment

 
Top