/* Peter Cline -- CISC105, July 2
   Writing a menu with functions,
	specifically using function return values
	*/

#include <stdio.h>

void printMenu();
int getMenuInput();

int main()
{
  printf("You entered option %d\n", getMenuInput());

  printf("\n");
  return 0;
}

int getMenuInput()
{
  int userInput;

  do {
    printMenu();
    scanf("%d", &userInput);
    if (userInput < 0 || userInput > 3)
      printf("Try again, bad input.\n");
    // read in user input
    // check to see whether it was a valid option
    // if it is invalid, print menu/scan
    // execute whatever the user asks
  } while (userInput > 3 || userInput < 0);
  return userInput;
}


void printMenu()
{
  printf("Enter one of the following:\n");
  printf(" 1) something fun\n");
  printf(" 2) something boring\n");
  printf(" 3) etc, etc\n");
  printf("Or enter 0 to quit: ");
}
