I want to create a rank checking function in C. Like if the entered character is alphabet rank is incremented. If it is arithmetic operators then rank is decremented. I can create this by using IF - ELSE statement but to compare i would have to write every alphabet using ||(or). I am trying to find a shortcut way. I am looking for some thing like this:
#define alphabets 'A'||'B'||'C'||'D' and so on
#define digits '1'||'2'|| and so on
So when i use IF-ELSE it should be like
if(char[i]==alphabets) rank--; if(char[i]==digits) rank++;
ps. english is not my first language.
Aucun commentaire:
Enregistrer un commentaire