I\'m creating a console app and using a switch statement to create a simple menu system. User input is in the form of a single character that displays on-screen
Just use tolower(), here's my man:
SYNOPSIS
#include ctype.hint toupper(int c); int tolower(int c);DESCRIPTION toupper() converts the letter c to upper case, if possible.
tolower() converts the letter c to lower case, if possible. If c is not an unsigned char value, or EOF, the behavior of these functions is undefined.RETURN VALUE The value returned is that of the converted letter, or c if the conversion was not possible.
So in your example you can switch() with:
switch(tolower(menuChoice)) {
case('q'):
// ...
break;
case('s'):
// ...
break;
}
Of course you can use both toupper() and tolower(), with capital and non-capital letters.