Print a Simple Menu C++

Explanation:

  1. Menu Display:
    • The program first displays a simple menu with four options:
      1. Start New Game
      2. Load Game
      3. Options
      4. Exit
  2. User Input:
    • The program prompts the user to enter a choice (a number between 1 and 4).
  3. Switch Statement:
    • The switch statement evaluates the user’s choice:
      • case 1: Prints “Starting a new game…”
      • case 2: Prints “Loading game…”
      • case 3: Prints “Opening options…”
      • case 4: Prints “Exiting the program. Goodbye!”
      • default: Handles any invalid choice (not between 1 and 4) by displaying an error message.
  4. Output:
    • Depending on the user’s choice, the program prints a corresponding message.

Example Outputs:

Example 1: Valid Choice

Input:

  • Choice: 1

Output:

Example 2: Valid Choice

Input:

  • Choice: 4

Output:

Example 3: Invalid Choice

Input:

  • Choice: 5

Output: