Created
October 26, 2024 17:17
-
-
Save m1irka/9c55e7afa1c1f774635e37cfbf52a2ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() { | |
| /*task 1 | |
| Користувач вводить із клавіатури символ. Визначити який це символ: буква, цифра,розділовий знак або інше. | |
| */ | |
| char symbol; | |
| cout << "Enter symbol, letter or number (a-z) (0-9) (.,:;!?): "; | |
| cin >> symbol; | |
| if ((symbol >= 'a' && symbol <= 'z') || (symbol >= 'A' && symbol <= 'Z')) | |
| { | |
| cout << "This is a letter" << endl; | |
| } | |
| else if (symbol >= '0' && symbol <= '9') | |
| { | |
| cout << "This is a number" << endl; | |
| } | |
| else if (symbol == '.' || symbol == ',' || symbol == ';' || symbol == ':' || symbol == '!' || symbol == '?') | |
| { | |
| cout << "This is a symbol" << endl; | |
| } | |
| else | |
| cout << "Error. Someting went wrong" << endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment