#include <stdio.h>

int main()
{
  int user_sel;   /* variable for user menu choice */
  char line[100]; /* container for line of user input */
  
  /* Show the user the menu of choices, and ask for choice */
  printf("1. Play game\n"
         "2. Load game\n"
         "3. Play multiplayer\n"
         "4. Exit\n"
         "Enter your selection: ");

  /* Get user input � more robust method than scanf */
  fgets(line, sizeof(line), stdin);
  int nread = sscanf(line, &user_sel);

  switch ( user_sel )
  {
  case 1:      /* Note the colon, not a semicolon */
    printf("\nOK, let�s play the game...\n");
    /* call game function here */
    break;

  case 2:      /* Note the colon, not a semicolon */
    printf("\nOK, loading the game...\n");
    /* call load game function here */
    break;

  case 3:      /* Note the colon, not a semicolon */
    printf("\nOK, multiplayer game...\n");
    /* call multiplayer game function here */
    break;

  case 4:      /* Note the colon, not a semicolon */
    printf("\nOK, thank you for playing!\n");
    break;

  /* Always should have a default case for unexpected cases */
  default:      /* Note the colon, not a semicolon */
    printf(" Error...!\n Bad input...! Read %d integer \n Quitting!!\n",nread);
    break;
  }
}