Find the character case || uppercase or lowercase


Write a program to determine whether the entered character is in an uppercase or lowercase, or is an invalid character.

Print.

1 for uppecase
0 for lowercase
-1 for any other character (special characters or others).

#include<iostream>

using namespace std;
int main() 
{
  char ch;
  cin >> ch;
  if(ch<=90 && ch>=65)
  {
    cout<<1<<endl;
  }
  else if(ch<=122 && ch>=97)
  {
    cout<<0<<endl;
  }else
  cout<<-1<<endl;


}

SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment