Question
Console Menu Class - for C++ You will write a Menu class that can be used to easily implement console menus, and you will demonstrate
You will write a Menu class that can be used to easily implement console menus, and you will demonstrate that your menus work with the main program in thestarter code. Your demonstration will include sub menues. Your menu class should work with the starter codes Source.cpp.You should not change Source.cpp at all(you may make minor changes if you wish to implement Menu in a slighly different way, but please check with me first).
Download the starter code. Do your work in the starter code project, zip it up into a zip archive and upload your work here.
A menu is made up of
- The first and last lines of the menu are a line of \"*\"s
- A header that says what the menu is about apears at the top of the menu items
- A list of menu items each menu item should have
- Akey, a single char that the user enters to select that item
- Adescription, the key and description are displayed by the menu
- Anaction, a function object, function pointer, or lambda, that does the action required for that menu selection
- An exit menu item with key Q, you can hard code this.
- Your menu should work for upper and lower case letters.
You may use the included data structure to hold the description and action, or you can desing your own.
struct MenuItem {
MenuItem() {}
MenuItem(const std::string& desc, std::function command)()>
: description(desc)
, command(command)
{ }
std::string description;
std::function command;()>
};
YouMUSTuse a map to store and loop up the menu item by key and perform the menu action.
Here's the starter code:
[ #include Menu.h 4 5 6 7 void hangman(); void fizzBuzz(); 8 9 10 11 @int main() { Menu menu( std::\">
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started