Topic:
Standard Input in C++
Problem:
Write a program that inputs a character and displays its ASCII code.
Solution:
#include<iostream.h> #include<conio.h> int main () { cout<<endl<<endl<<endl; char c; int num; cout<<"enter a cahracter:"; cin>>c; num=c; cout<<endl<<"the ASCII code of:"<<c<<"is:"<<num; getch(); }
Output:
Let me know in the comment section if you have any question.
Previous Post:
Next Post: