Hey
I am trying to use a case switch statement to choose from a menu option but It will not allow to use letters as an option. If the user put in a letter I would like for it to say invalid option but instead it continuously loops.
Any help would be fantastic.Code:#include <stdio.h> void playgame(); void loadgame(); void multi(); void scores(); void quit(); int main (int argc, const char * argv[]) { // insert code here... char input; do{ printf("\n\n"); printf("1. Play New Game\n"); printf("2. Load Previous Game\n"); printf("3. Play Multiplayer\n"); printf("4. View High Scores\n"); printf("5. Quit\n"); printf("\nChoose an option and press enter: "); scanf("%d",&input); switch (input) { case 1: playgame(); break; case 2: loadgame(); break; case 3: multi(); break; case 4: scores(); break; case 5: quit(); break; default: printf("\nInvalid Choice!\n"); break; } } while (input !=5); //end return 0; } void playgame(){ printf("\nStarting new game...."); } void loadgame(){ printf("\nChoose from a save file"); } void multi(){ printf("\nConnecting to servers!"); } void scores(){ printf("\nHigh Scores~"); } void quit(){ printf("\nThanks for playing..."); }