Answer to Question #12629 in C++ for Bob
You can use Vectors to contain the data structures.
1. Create a data structure to represent the record (struct cost in cost.h)
2. Write a function called parse_account that parses one (string) record from a file, and populates a data structure with that data.
3. Write a function called sum_accounts that, when passed a container of structures, returns a double representing the sum of the amounts in those structures.
4. Create a main program
a) Create an appropriate container of data structures
b) Open the accounts file (costfile.txt)
c) While you can read a line from the file without error
Call parse_account, which returns a data structure.
Add the returned data structure to the container (using, pushToV)
d) Call sum_accounts to determine the amount of money represented
e) Print a message and the result.
Pass_Go 200.0 135
Reading_RR -50.0 136
Connecticut -120.0 137
Chance 25.0 138
Unfortunately, your question requires a lot of work and cannot be done for free.
Submit it with all requirements as an assignment to our control panel and we'll assist you.
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!