Getting a Total

I've been having trouble getting all my cin amounts to add together for a total amount that I can use within a void statement.
Last edited on
just create a variable named total and when each value is inputted do: total+=whatevertheamount is
I kept getting a weird amount that didn't match up with my math
in main create a variable total or something like that and set it to equal GetAmountSpent(). have the getAmountSpent() function add up the totals and return that total. then in main pass total(or whatever you named the variable) as a parameter to getBudgetReport() so you can use it in the function and do whatever you want with it.
Last edited on
Oh! Okay. I hadn't thought about that. Solved the problem right away. Thanks!
the other way would be to use reference variables, but that's a tiny bit more complicated(not really that much).
Last edited on
Topic archived. No new replies allowed.