Program to enter a character and output its ASCII code 1 Attachment(s) Program to enter a character and output its ASCII code #include #include void main() { clrscr(); char charac; cout << "Enter the character : " << endl; cin>>charac; int num1=charac; cout << "The ASCII code for " << charac << " is " << num1 << "." << endl; getch(); } It then finds out its ASCII code and outputs it using the 'cout' command. Sample Input a Sample Output The ASCII code for a is 97. |
All times are GMT +5. The time now is 04:02 PM. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.