-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.cpp
More file actions
30 lines (26 loc) · 897 Bytes
/
menu.cpp
File metadata and controls
30 lines (26 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include "menu.h"
#include "states.h"
using namespace std;
int Menu::show() {
/// Display the main menu
// Show the menu entries
cout << "Welcome to the World of ..." << endl << endl\
<< "1) Start Game" << endl \
<< "2) Options" << endl \
<< "3) Quit Game" << endl;
// get the user input
string selection;
cout << "choose: ";
cin >> selection;
// check the user input and return the new game state
if (selection == "1" or selection == "start" or selection == "s" or selection == "start game") {
return gameState;
} else if (selection == "2" or selection == "options" or selection == "o") {
return optionsState;
} else if (selection == "3" or selection == "quit" or selection == "q" or selection == "quit game") {
return exitState;
} else {
return unknownState;
}
}