C++ : read a character and print its integer equivalent


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char a;
cout<<"Enter any character : ";
cin>>a;
cout<<endl<<endl;
cout<<"The equivalent integer value of "<<a<<" is "<<static_cast<int>(a)<<endl;
getch();
return(0);
}

No comments:

Post a Comment