Sample – Program to enter a letter and output the next 2 letters.

by Nideesh C on February 8, 2011 · 0 comments

in C++




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

void main()
{
clrscr();
char charac;
cout << “Enter your letter : ” << endl;
cin>>charac;
cout << “The 2 letters are : ” << endl;
cout << (char)(charac-1) << endl;
cout << (char)(charac+1) << endl;
getch();
}

This program takes in a letter charac of the English alphabet as a screen input from the user.
It then determines its previous letter and next letter and prints it out 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 an integer and output it in the reversed form.
  3. Sample – Program to enter salary and output income tax and net salary.
  4. Sample – Program to enter an integer and output its 15 multiples.
  5. Sample – Program to enter a string and find its length.

Leave a Comment

Previous post:

Next post: