Check Character weather Up & Low Case

 #include<iostream>

using namespace std;

int main(){

char s;

int x;

cout<<"Enter Character "<<endl;

cin>>s;

x = static_cast<int>(s);

(x>=65  && x<=90)?cout<<"Character is in UpperCase"<<endl:

(x>=96 && x<=122)?cout<<"Character Is In LowerCase"<<endl:

cout<<"wrong Input";

return 0;

}

---------------------------------------------------------------------------------------------------------------

If statement programming.

#include<iostream>

using namespace std;

int main(){

char c;

int d;

cout<<"Enter Character "<<endl;

cin>>c;

d = static_cast<int>(c);

if(d>=65  && d<=90)

cout<<"Character is in UpperCase"<<endl;

else

if(d>=96 && d<=122)

cout<<"Character Is In LowerCase"<<endl;

else 

if(d>=48&&d<=57)

cout<<endl<<"You Entered A Number";

else

cout<<"Special Character"<<endl;

return 0;

}

Comments

Popular Posts