Tuesday 17 June 2014

C++ program to check whether the given input is alphabet or not



Here is a C++ program to check whether the given input is alphabet or not


 SOURCE CODE OUTPUT
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    char n=65,num=122;
    cout<<"Enter the character ";
    cin>>num;
    for(char i=65;i<=90;i++)
     {
        if(i==num)
        {
            cout<<"Given input is Alphabet";
            return 0;
        }
     }
     for(char i=97;i<=122;i++)
     {
        if(i==num)
        {
            cout<<"Given input is Alphabet";
            return 0;
        }
     }
     cout<<"Given input is not an Alphabet";
     return 0;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment