/* Program: menu.c Another robust input program. */ #include #include "genlib.h" #include "simpio.h" main() { int selection ; bool flag ; printf("Welcome to the automated menu program.\n") ; printf("Our selections for today are:\n") ; printf(" 1. Hamburger\n") ; printf(" 2. Hamburger with cheese\n") ; printf(" 3. Hamburger with cheese and bacon\n") ; printf(" 4. Hamburger with cheese, bacon" " lettuce and tomato\n") ; flag = TRUE ; while (flag) { printf("Please enter your selection: ") ; selection = GetInteger() ; switch(selection) { case 1: printf("Please pay $1.25\n") ; flag = FALSE ; break ; case 2: printf("Please pay $1.35\n") ; flag = FALSE ; break ; case 3: printf("Please pay $1.65\n") ; flag = FALSE ; break ; case 4: printf("Would you like fries with that?\n") ; flag = FALSE ; break ; default: printf("Please enter 1-4 only.\n") ; } } }