Tuesday, July 1, 2014

Program to display ASCII code of a character and vise versa.

#include<iostream.h>
#include<conio.h>
int main()
{
 clrscr();
 char ch='A';
 int num=ch;
 cout<<"The ASCII code for "<<ch<<"is"<<num<<"\n";
 cout<<"Adding 1 to the character code: \n";
 ch=ch+1;
 num=ch;
 cout<<"The ASCII code for"<<ch<<"is"<<num<<"\n";
 return 0;
}


Output:-
The ASCII code for A is 65
Adding 1 to the character code :
The ASCII code for B is 66

No comments:

Post a Comment