Skip to content

Instantly share code, notes, and snippets.

@m1irka
Created October 26, 2024 17:17
Show Gist options
  • Select an option

  • Save m1irka/9c55e7afa1c1f774635e37cfbf52a2ec to your computer and use it in GitHub Desktop.

Select an option

Save m1irka/9c55e7afa1c1f774635e37cfbf52a2ec to your computer and use it in GitHub Desktop.
#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