Character to
ASCII conversion in C Plus Plus Program
ASCII
ASCII
stands for American Standard Code for Information Interchange. These are some
unique codes assigned to every character, digits and special symbols.
Our
task is to find out the ASCII number associated with the each character.
Scenario
We
will develop a program which will take the character form user and provide them
the ASCII code.
So
Let’s start
Character
to ASCII conversion in C++ Program
Code
#include<iostream>
using
namespace std;
int
main()
{
do{
cout<<"\nEnter
Character :";
char a;
cin>>a;
cout<<"Ascii Value
="<<static_cast<int>(a);
}
while('a');
return 0;
}
We
have make use of the built in static_cast to print the ASCII code.
Character to
ASCII conversion in C++ Program
Output
And
here we have some sample to show you how this program behaves with the user.
^^^^^^^^^^^^^^^^^^Thanks
You^^^^^^^^^^^^^^^^^^^^^^^^^^^
Post a Comment
Feel Free to Comment Us