How many open parentheses do you have?
How many closed parentheses do you have?
Are these the same number? If not, where is one missing?
Also, the syntax a == (b,c,d)
is not shorthand for a == b || a == c || a == d
like you seem to think. It's actually equivalent to a == d
due to the way the comma operator works.
To be completely explicit, what you actually want is this:
while (selection == 'a' || selection == 'b' ||
selection == 'c' || selection == 'd' ||
selection == 'e' || selection == 'f' ||
selection == 'g' || selection == 'h' ||
selection == 'i' || selection == 'A' ||
selection == 'B' || selection == 'C' ||
selection == 'D' || selection == 'E' ||
selection == 'F' || selection == 'G' ||
selection == 'H' || selection == 'I')
{
/* Do stuff */
}
Or, to be a lot more consice about it, you can take advantage of the fact that the letters are arranged alphabetically in the ASCII table, and write
while (tolower(selection) >= 'a' && tolower(selection) <= 'i')
{
/* Do stuff */
}
This requires inclusion of <ctype.h>
for the tolower
function.