C++ Program To Check Character Is Uppercase, Lowercase Alphabet Or A Digit Or A Special Symbol

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
    char ch;//Variable declaration
    cout<<"Enter a character: ";
     cin>>ch;//store the entered character
     if(ch>='A' && ch<='Z'){//check upper case
    cout<<ch<<" is an upper case letter ";
}
else if(ch>='A' && ch<='z'){//check lower case
    cout<<ch<<" is a lower case letter ";
}
else{
    cout<<ch<<" is not an Alphabets ";
}
getch();
    return 0;
}

OUTPUT:

When the above code is executed, it produces the following result
Case 1
Enter a character: C
C is an upper case letter
Case 2
Enter a character: j
j is a lower case letter
Case 3
Enter a character: *
* is not an Alphabets

Sharing Is Caring

Leave a Comment