switch Menu

Lab C++ Beginner 10 points

Read a menu choice 1–4 and print Start, Settings, Help, Quit or Invalid choice.

Input

n, then n integers.

Output

n lines.

Example

Input

5
1
3
4
9
2

Output

Start
Help
Quit
Invalid choice
Settings
Sample input available Sample output available
Editor
C++

Hints

Each case needs a break, or it falls through to the next.

Solution explanation

switch is a clean way to branch on one integer value.

Show solution
#include <iostream>
using namespace std;

int main() {
    int n, choice;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> choice;
        switch (choice) {
            case 1: cout << "Start\n"; break;
            case 2: cout << "Settings\n"; break;
            case 3: cout << "Help\n"; break;
            case 4: cout << "Quit\n"; break;
            default: cout << "Invalid choice\n";
        }
    }
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD