Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Console Menu Class - for C++ You will write a Menu class that can be used to easily implement console menus, and you will demonstrate

Console Menu Class - for C++

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

  1. The first and last lines of the menu are a line of \"*\"s
  2. A header that says what the menu is about apears at the top of the menu items
  3. A list of menu items each menu item should have
    1. Akey, a single char that the user enters to select that item
    2. Adescription, the key and description are displayed by the menu
    3. Anaction, a function object, function pointer, or lambda, that does the action required for that menu selection
  4. An exit menu item with key Q, you can hard code this.
  5. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

Students also viewed these Programming questions

Question

-x/2 x/4 If A = -x/2 and A-1 =6 then x equals

Answered: 1 week ago