Assignments » Variable, Operator and Expression » Set1 » Solution 6

Write a program which accepts a character and display its ASCII value.

    
#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;
}

Enter any character : A
ASCII equivalent is : 65