hello, i'm having a switch-case problem. if a letter is entered the default works but the program acts all crazy after that please help.
Also for the switch statement to loop i left out the break after default is this ok?
Code:#include <stdio.h> void std(); void etc(); int main(){ int c; do { printf("Menu:\n\n"); printf("\n1 - std"); printf("\n2 - etc.."); printf("\n0 - exit"); printf("\n\nChoice: "); scanf("%d",&c); switch(c){ case 1: std(); break; case 2: etc(); break; case 0: break; default: printf("\n\nIncorrect Entry!,Please press enter and Try again!\n\n");// stops working if a letter is pressed getch(); } }while(c!=0); } void std(){ int std_id; char name[20]; do{ printf("enter student id or '0' to exit\n"); scanf("%d",&std_id); while(std_id!=0){ printf("enter students name\n"); scanf("%s",&name); break;} }while(std_id!=0); } void etc(){ }