Question: Need help writing code in C++ for this assignment A32. (25 pts) You must use a do while loop in the following program: Write, compile,
A32. (25 pts) You must use a do while loop in the following program: Write, compile, debug, and a program that will use the specified loops to do the following This program will ask the user for items to buy and their quantities, and write a shopping list to a file. Open a file named shopping.txt for write access . Use a do while loop to get the items from the user Prompt the user for an item to place on the shopping list (ie. apples) . Prompt for the quantity of that item, using the name of the item in the prompt For example, if the user entered-apples", promptHow many apples?. (don't worry about grammar and plurals.) o Write each item and its quantity to the file, quantity first (i.e. 5 apples) Ask the user if they want to keep entering items Loop until the user enters N or n to this question (loop should only end if they enter N or n.) (This is the do while loop condition.) . Close the file .. open the same file for read access Use another loop of your choice to Read each item and quantity from the file Display the shopping list to the screen, with each quantity and item on a new line (after a heading line) o o Close the file Your output should look similar to this: Here is your shopping list for today 5 apples 1 bread 2 milk Code Header input/output Show the complete input and expected output of one example using 3 items
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
