Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

Need help writing code in C++ for this assignment image text in transcribed
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

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

Step: 3

blur-text-image

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

2. The model is credible to the trainees.

Answered: 1 week ago