Answered step by step
Verified Expert Solution
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.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started