Wednesday, 15 April 2020

C++ Program - ASCII Character

Q: Write a program which accepts a character and display its ASCII value. 
Solution:

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
 char ch;
 cout<<"\nEnter any character : ";
 cin>>ch;
 cout<<"ASCII equivalent is : "<<static_cast<int>(ch);
 return 0;
}
  Screenshot:

 

No comments:

Post a Comment