Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 exampleStep 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