Check uppercase in C++ by R4R Team

UPPERcase alphabet:


Example-

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


All these alphabet is the upper case.

ASCII value for upper case alphabet:

A=65

B=66

C=67

.....

Y=89

Z=90


program:

#include < iostream>

using namespace std;
int main()
{
char s;
cout<<"Enter any Character"<< endl;
cin>>s;
if(s>='A' && s<='Z')
cout<<"It is upper case";
else
cout<<"It is not a upper case";
return 0;
}


output-

Enter any character
G
It is upper case

Enter any character
h
It is not a upper case

-In this program, we take a input of the alphabet and check whether it is a upper case or not.

-if((ch>='A' && ch<='Z'))

will execute if alphabet is of UPPER case otherwise it implies as lower case 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!