Check character is alphabet or not in C++ by R4R Team

Alphabet characters:

All English character are the alphabet characters.

Example-

a,b,c,d,...............x,y,z

A,B,C,D,...............X,Y,Z


How we identify?

-We use te ASCII value concept to identify each and every character of the keyword.

ASCII value for lower case alphabet:

a=97,b=98,.........z=122

ASCII value for upper case alphabet:

A=65,B=66,..........Z=90




program:


#include < iostream>
#include< math.h>
using namespace std;
int main()
{
char ch;
cout<<"Enter any Character"<< endl;
cin>>ch;
if((ch>='A' && ch<='Z')||(ch>='a' && ch<='z'))
cout<<"Character is alphabet";
else
cout<<"Character is not alphabet";
return 0;
}


output-

Enter any Character
F
Character is alphabet

Enter any Character
7
Character is not alphabet




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!