Sample – Program to enter a character and output its ASCII code.

by Nideesh C on February 8, 2011 · 0 comments

in C++




#include <iostream.h>
#include <conio.h>

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();
}

This program takes in any character charac as a screen input from the user.
It then finds out its ASCII code and outputs it using the ‘cout’ command.

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to identify if an input is a symbol, digit or character.
  2. Sample – Program to enter a letter and output the next 2 letters.
  3. Sample – Program to enter an integer and output it in the reversed form.
  4. Sample – Program to compute the fibonacci series.
  5. Sample – Program to convert days into years and weeks.

Leave a Comment

Previous post:

Next post: