-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.cpp
58 lines (50 loc) · 2.11 KB
/
Menu.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/***************************************************************************************************
** Author: Michael Johnson
** Date: 7/19/2017
** Description: Definitions of the menu class functions
***************************************************************************************************/
#include "Menu.h"
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::cin;
using std::endl;
/****************************************************************************************************
** displayMenu
** Displays the menu of game options on the screen.
** I pulled this function idea from the textbook.
****************************************************************************************************/
void Menu::displayMenu()
{
cout << "\n Oregon State University" << endl;
cout << "1. Enter a new person" << endl;
cout << "2. Enter a new building" << endl;
cout << "3. Print building information" << endl;
cout << "4. Print person information" << endl;
cout << "5. Assign work" << endl;
cout << "6. Exit" << endl;
cout << endl;
}
/****************************************************************************************************
** setChoice
** Sets the menu choice from the user
****************************************************************************************************/
void Menu::setChoice()
{
cout << "Choose an option: " << endl;
choice = inputVal1.isPosInteger();
while (choice > 6 || choice < 1)
{
cout << "Choose an option: " << endl;
choice = inputVal1.isPosInteger();
}
}
/****************************************************************************************************
** getChoice
** Gets the menu choice from the user and returns it
****************************************************************************************************/
int Menu::getChoice()
{
return choice;
}