Sorry it took me so long to get back to you.
When you're looking at the first character of the input, you can find out if it's alphabetic by using the
isalpha function. If it is, you can convert it to upper case, subtract the character '@' from it and convert it to an integer. Thus 'a' would be converted to 1, 'B' would be converted to 2 etc. After that, you can simply check to see if the integer is in the range 1-7, and you won't need the massive switch statement.
Perhaps that wasn't clear enough. Here's some pseudo-code:
1. Check if the
sinput[0] character is alphabetic.
2. If YES:
2a. Convert the character to upper case using the
toupper function.
2b. Assign the value of (converted character - '@') to a predefined integer variable (let's call it
row).
3. Otherwise:
3a. Assign the value of (converted character - '0') to
row
4. Check if
row is in the range 1-7. If it is, you have valid input for the first character. Otherwise you have an error.
I hope that's clear. See how you go translating it into code. A similar approach should be used for the second character (i.e. the seat number on a particular row).
Let us know how you go.
P.S. Check out the ASCII character chart to see how this conversion from characters to integers works:
http://en.wikipedia.org/wiki/Ascii#ASCII_printable_characters
P.P.S. The functions I mentioned (like
toupper) are C functions. Google them if required.