Question: 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.

How do you edit data within a file on C++? We have

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!