Check enter character is upper case or lower case | Upper case or lower case
# include <iostream>
using namespace std;
void main(){
char character;
cout<<"Please enter the Character: ";
cin>>character;
int code=character; // for ASCII codes
if (code>=65 && code <=90)
cout<<"The entered character is in uppercase"<<endl;
else if (code >=97 && code<=122 )
cout<<"The entered charcter is in lowercase"<<endl;
else
cout<<"You can only input Alphabets"<<endl;
}
using namespace std;
void main(){
char character;
cout<<"Please enter the Character: ";
cin>>character;
int code=character; // for ASCII codes
if (code>=65 && code <=90)
cout<<"The entered character is in uppercase"<<endl;
else if (code >=97 && code<=122 )
cout<<"The entered charcter is in lowercase"<<endl;
else
cout<<"You can only input Alphabets"<<endl;
}
Comments
Post a Comment