Syvum Home Page

Home > Quiz Games > C++ Programming > Print Preview

C++ Programming : Program 38-A

Program to enter a letter and output the next 2 letters


 

#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.

x

The next 2 letters after x are :
y
z

Index of C++ Programs
 

-
-
 
45 more pages in C++ Programming

Contact Info © 1999-2024 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright