Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do you edit data within a file on C++? We have been using ifstream and ofstream but we didn't go over how to edit

How do you edit data within a file on C++? We have been using ifstream and ofstream but we didn't go over how to edit within.

image text in transcribed

If the user selects B., request the Account Number, Date, Description, and Amount from the user. Open the file with the file name "xxx.dat" where xxx is the Account Number requested from the user. If the file does not open, alert the user and return to the menu. The file should be opened in read/write mode and set to append data so as to not overwrite existing data. Read the last line in the file, which should be the balance of the account the last time a transaction was added. Write the Date, Description, Amount, and calculated new balance, each of these four data elements on a separate line in the file. The calculated new balance can be found from the balance read from the file plus/minus the Amount. Close the file. Return to the menu. As an example, when step 3 is complete, the file might look like: 11/01/2017 Initial Deposit 1000 1000 11/14/2017 Titan Bookstore Online -245.67 754.33

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_2

Step: 3

blur-text-image_3

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

Students also viewed these Databases questions

Question

Describe 4GLs and their characteristics.

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago