-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiceMenu.cpp
54 lines (46 loc) · 1.92 KB
/
DiceMenu.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
/***************************************************************************************************
** Author: Michael Johnson
** Date: 7/16/2017
** Description: Definitions of the menu class functions
***************************************************************************************************/
#include "DiceMenu.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 Dice War" << endl;
cout << "1. Play war" << endl;
cout << "2. Quit game" << endl;
cout << endl;
}
/****************************************************************************************************
** setChoice
** Sets the menu choice from the user
****************************************************************************************************/
void Menu::setChoice()
{
cout << "Choose an option: " << endl;
choice = inputVal1.isPosInteger();
while (choice > 2 || 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;
}