Hi!
I haven't done a lot of coding before, but now I'm working on this budget/accounting-program. My first goal is to develop a program were the user puts in an amount of money they have spent and which category it's in (food, rent, clothes, etc). This information will then be stored in a .txt file. An example of how I want it to look like:
Food 500
Rent 1000
Clothes 300
Where the number represents the sum of all the amounts of money spent in that category that month. And this is where I'm stuck - how do I sum all these inputs (and ofcourse keep the categories divided)?
The way I work: I start reading from the file, and loads the whole file into a vector, using push_back. When the user is done with their input, the vector is then loaded back to the file. The category is a string, and the amount and the sum is integers.
Any tips? Is it better to change the file directly, or use arrays instead of a vector?
Surprised no one has responded yet as it doesn't seem a hard problem in itself. Unfortunately I am in the beginner c++ category and know nothing yet about vectors or push_back. I have done similar things in plain old c but that is not what you need. I don't even know how to deal with multiple files yet.