Dec 11, 2011

Program : To Display ASCII code of character

Program : To Display ASCII code of character Take Character From User

#include<iostream.h>
#include<conio.h>
int main()


{
char ch;  //declare character variable can store one character only
int ascii; // declare ascii as integer can store numeric value
cout << "ENTER Any Character \n";  //Display This on screen \n for new line
cin >> ch; /*Take Value in ch variable that charater only if wrong input is given then it give error and your program exit*/
ascii = ch; //change character variable to integer variable as ASCII codes are Integer Variable

cout << ch <<"ASCII Code is = " << ascii ; // display Ascii Code of that character


getch();
return 0;
}

OUTPUT






0 comments:

Post a Comment