C++ Program to Find ASCII Value of any entered character
#include<iostream>
using namespace std;
int main()
{
char ch;
int n;
cout<<"==================================================\n";
cout<<"\t ASCII VALUE OF CHARACTER\n";
cout<<"==================================================\n";
cout<<"Enter Any Key to get it's ASCII value : ";
cin>>ch;
n=ch;
cout<<"The ASCII Value of "<<ch<<" is "<<n<<endl;
cout<<"2nd Method using typecasting concept.\n";
cout<<"Enter any character to get its ASCII Value : ";
cin>>ch;
cout<<"The ASCII Value of "<<ch<<" is "<<(int)ch<<endl;
cout<<"==================================================\n";
return 0;
}
Comments
Post a Comment