/* Course Number : ISYS 116 Student Name : Jason Gradziel Student Number : 826-135-535 Professors Name : Gene Rychlewski Class Name : Thursday Lab Title : Case Structure */ #include #include #include /* Sample Menu Program Using switch structure & Dummy functions to demonstrate menu structure */ /* Function Prototypes */ void setup(void); void process(void); void wrapup(void); void prtmenu(void); void choose(void); void exampleA(void); void exampleB(void); void exampleC(void); /* Globle Variables */ int choice; //char chara[1], // *charact[1]; /* Mainline logic */ void main (void) { setup(); process(); wrapup(); } /* Subroutines */ void setup(void) { prtmenu(); choose(); } void process(void) { /* loop to process choice */ while (choice != 0) { switch (choice) { case 1: exampleA(); break; case 2: exampleB(); break; case 3: exampleC(); break; case 0: break; default: gotoxy(26,15); printf("Invalid choice - try again"); gotoxy(26,16); printf("Press any key to continue"); getch(); } setup(); } } void wrapup(void) { gotoxy(35,23); printf("D O N E !!"); getch(); } void prtmenu(void) { /* print screen, title & prompt for choice */ clrscr(); gotoxy(26,1); printf("**************************"); gotoxy(26,2); printf("* Sample of Menu Program *"); gotoxy(26,3); printf("**************************"); gotoxy(26,5); printf("Select one of the following"); gotoxy(30,7); printf("1 Sample item A"); gotoxy(30,8); printf("2 Sample item B"); gotoxy(30,9); printf("3 Sample item C"); } void choose(void) { /* get maenu choice */ gotoxy(26,15); printf("Enter your choice: "); scanf("%d", &choice); //charact = getc(chara); /*if (chara != '1' && chara != '2' && chara != '3' && chara != '0') { gotoxy(26,15); printf("Invalid choice - try again"); gotoxy(26,16); printf("Press any key to continue"); getch(); setup(); }*/ //*charact = chara; //choice = atoi(*charact); } void exampleA(void) { gotoxy(30,20); printf("Example A routine "); getch(); } void exampleB(void) { gotoxy(30,20); printf("Example B routine "); getch(); } void exampleC(void) { gotoxy(30,20); printf("Example C routine "); getch(); }