A C++ program that inputs a character and displays its ASCII code
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
char character;
cout<<"Enter a character : ";
cin>>character;
int num1 = character;
cout<<"The ASCII code for "<<character<<" is "<<num1<<"."<<endl;
return 0;
}
output:
Enter a character : a
The ASCII code for a is 97.
The ASCII code for a is 97.
1 Comments
Useful
ReplyDelete