-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.cpp
53 lines (46 loc) · 1.96 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
/***************************************************************************************************
** 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 << "\tRecursive Functions" << endl;
cout << "1: Use reverse string function" << endl;
cout << "2: Use sum array function" << endl;
cout << "3: Use triangular number function" << endl;
cout << "4: Exit" << endl;
cout << endl;
}
/****************************************************************************************************
** setChoice
** Sets the menu choice from the user
****************************************************************************************************/
void Menu::setChoice()
{
do
{
cout << "Choose an option: " << endl;
choice = inputVal1.isPosInteger();
} while (choice > 4 || choice < 1);
}
/****************************************************************************************************
** getChoice
** Gets the menu choice from the user and returns it
****************************************************************************************************/
int Menu::getChoice()
{
return choice;
}