A student has established a monthly budget in this file, where:
- The first column represents the name of the expense
- The second one the amount of money set aside for it.
The program should have one constant integer:
- EXPENSE_COUNT = 10
The program should have a structure Expensewith the following members:
- A string Namethat holds the name of the expense.
- A float Budgetthat holds the amount of money set aside for it.
- A float Spentthat holds the amount of money spent that month in that category.
Write a program that contains the following functions:
- ReadData: Takes a reference to an fstreamcalled InputFileand an array of Expensecalled Spending.
- Reads the contents of InputFileinto the corresponding elements of Spending, so that the first element of every line goes into Nameand the second one into Budget.
- UserUpdate: Takes an array of Expensecalled Spending.
- It displays each of the elements of Spending by name and asks the user how much they spent in said category. It stores this amount in said element under Spent.
- Display: Takes a reference to an fstreamcalled OutputFileand an array of Expensecalled Spending.
- Prints into a file the following:
- A header line with “Name”, “Goal”, “Spent” and “Difference”.
- For each element of Expenses, a line with the value of Name, Budgetand Spent, followed by the difference between Spentand Budget.
- Prints into a file the following:
Write a program that contains an array of elements of the Expensestructure and follows these guidelines to take the file provided to you and asks the user to enter the amount they have spent, then produces another file with the original information plus that introduced by the user and the difference between the amount spent and the original goal.