Question: in c++ In class when we were talking about loop structures, we wrote a menu-driven while loop. We prompted the user to make a choice
in c++
In class when we were talking about loop structures, we wrote a menu-driven while loop. We prompted the user to make a choice of an item to purchase, with a flag to quit. With each purchase we summed up the bill, and when the user decided to quit, we printed out the final amount owed. I would like you to modify this program so that the menu is displayed and the user choice is gotten and returned from a function. Provide the user with three options of things they can purchase, as well as the price of each item. As in the example from class, when the user is done purchasing items, display the total bill. The basic structure (with many details left out) would be as follows: choice = getChoice(); while(choice != 0) add the latest purchase to the bill choice = getChoice(); In this example, getChoice displays the options and prices) to the user, and then reads in the user's choice. This choice is then returned as the function's return value. The flag to quit is O in the above example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
