C++ Program to Display ASCII code of a Character


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
int main()
{
clrscr();
char val;
cout<<"\n\t Enter the Character:"
gets(val);
char ch=val;  //assign ASCII code for val to ch
int num=ch;   //store same code in an int
cout<<"\n\t The ASCII code for"<<ch<<"is"<<num<<"\n";
ch=ch+1;
num=ch;
cout<<"\n\t The ASCII code for"<<ch<<"is"<<num<<"\n";
return 0;
}

Labels: , , , , , ,