Advertisement
mustahidhasan

alphabet number or special char

May 11th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int n, i;
  6.     cout << "Test cases =";
  7.     cin >> n;
  8.     char a[n + 1];
  9.  
  10.     for(i = 1; i <= n; i++){
  11.        cin >> a[i];
  12.     }
  13.     for(i = 1; i <= n; i++){
  14.         if(a[i] >= 48 && a[i] <= 57)
  15.             cout << a[i] << " is a Digit" << endl;
  16.         else if((a[i] >= 65 && a[i] <= 90) ||(a[i] >= 97 && a[i] <= 122))
  17.             cout << a[i] << " is an Alphabet" << endl;
  18.         else{
  19.             cout << a[i] << " is special character" << endl;
  20.         }
  21.  
  22.     }
  23.  
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement