Advertisement
avr39ripe

cppLetterNumberPunctOtherChecker

Feb 1st, 2022
953
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     char symbol;
  6.  
  7.     std::cout << "Enter some symbol\n";
  8.     std::cin >> symbol;
  9.  
  10.     if (symbol >= '0' and symbol <= '9')
  11.     {
  12.         std::cout << "This is number\n";
  13.     }
  14.     else if ((symbol >= 'a' and symbol <= 'z') or (symbol >= 'A' and symbol <= 'Z'))
  15.     {
  16.         std::cout << "This is letter\n";
  17.     }
  18.     else if (symbol == '!' || symbol == '?' || symbol == '.' || symbol == ',' || symbol == '\"' || symbol == '\'' || symbol == ';' || symbol == ':')
  19.     {
  20.         std::cout << "This is punctuation mark\n";
  21.     }
  22.     else
  23.     {
  24.         std::cout << "Some other symbol\n";
  25.     }
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement