Advertisement
jhnksr

Character Identification

Sep 28th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | Source Code | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.    
  6.     char ch;
  7.     cout << "Enter any character: ";
  8.     cin >> ch;
  9.     if ((ch >= 'A') && (ch <= 'Z'))
  10.     cout << "It is an Uppercase letter";
  11.     else if ((ch >= 'a') && (ch <= 'z'))
  12.     cout << "It is a lowercase letter";
  13.     else if ((ch >= '0') && (ch <= '9'))
  14.     cout << "It is a digit";
  15.     else
  16.     cout << "It is a special character";
  17.    
  18.     return 0;
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement