I don’t know if I understood your doubt correctly, but if I understand it correctly it is possible yes
See the code:
#include <stdio.h>
int main()
{
char op;
scanf(" %c", &op);
switch (op) {
case '+':{ printf("Hello World"); break; }
/* outras opções */
}
return 0;
}
It is actually possible to recognize by char type any character that is in the table ASCII. Take a look, it might just be that.
Note that I had to use a variable of type char and not int to make it work. In this case your program will compare to any type of character, in case what you search is the character corresponding to the sign "+".
Note also that in this case I used single quotes, this is because in C and C++ it is understood that double quotes are used for strings, which are nothing more than a string (or vector) of characters, the single quotes is understood for even characters.
I hope I’ve helped. :)
My C is rusty, but try looking for the symbols by matching char, for example,
case #10– DH.
Did any of the answers solve the problem? Do you think you can accept one of them? See [tour] how to do this. You’d be helping the community by identifying the best solution. You can only accept one of them, but you can vote for anything on the entire site.
– Maniero