C++ Program to Check Given Character is Uppercase, Lowercase, Digit or Special Character

Below I have shared C++ program to check whether a given character is an uppercase or lowercase alphabet, a digit or a special character. First of all I read a character an then compare it with ASCII values given below.

Uppercase Alphabet: 65-90

Lowercase Alphabet: 97-122

Digit: 48-57

If ASCII value of character is other then the values mentioned above then it is a special character.

C++ Program to Check Given Character is Uppercase, Lowercase, Digit or Special Character

 

Output

Enter any character: F

You entered an uppercase character

One thought on “C++ Program to Check Given Character is Uppercase, Lowercase, Digit or Special Character

  1. Saksham Dwivedi

    I have a question regarding this program.
    I tried writing this concept in form of nested if-else statements like the “dangling if-else statement”.
    eg:
    if(expr 1)
    if(expr 2)
    statement 1;
    else
    statement 2;
    .
    .
    .
    the program doesn’t work… What’s wrong in this concept?
    Please do reply.
    Thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.