Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If necessary, create a new project named Introductory20 Project and save it in the Cpp8Chap14 folder. Also create a new source file named Introductory20.cpp. Create

If necessary, create a new project named Introductory20 Project and save it in the Cpp8\Chap14 folder. Also create a new source file named Introductory20.cpp. Create a program that saves prices in a sequential access file. Save the prices in fixed-point notation with two decimal places. Name the sequential access file Introductory20.txt and open the file for append. Use a negative number as the sentinel value. Save and then run the program. Enter the following prices and sentinel value: 10.50, 15.99, and -1. Now, run the program again. This time, enter the following prices and sentinel value: 20, 76.54, 17.34, and -1. Open the Introductory20.txt file in a text editor. The file should contain five prices, with each price appearing on a separate line in the file. Close the Introductory20.txt file.

Notice:

  • The Sequential Access File is named "Introductory20.txt"
  • The File is opened in append mode.
  • You use negative numbers as the sentinel value.

(Note:Allnegative numbers can be sentinel values not just -1)

  • Output is formatted with:

New lines between each number

Numbers are formatted in fixed-point notation with 2 decimal places

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

To outline alternative perspectives of ethical decision-making

Answered: 1 week ago