Calling Functions Help

May 12, 2011 at 9:14pm
Thanks for your help
Last edited on May 12, 2011 at 10:14pm
May 12, 2011 at 9:17pm
You need to pass "monthlyIncome" to "computeTaxes(...)". Also you should do something with the value returned from "computeTaxes(...)" right now it's not getting saved anywhere.

EDIT: This might help, it's a quick read either way: http://www.cplusplus.com/doc/tutorial/functions/
Last edited on May 12, 2011 at 9:17pm
May 12, 2011 at 9:29pm
K. I edited it a little. I guess what I'm having trouble with is where do I pass "monthlyIncome" to "computeTaxes()". Do I have to put it in the function I called in main or in the "computeTaxes()" function itself?
May 12, 2011 at 9:33pm
You have a scope issue with "budgetTaxes", it is a variable inside of your "computeTaxes(...)" function but Main() has never heard of it. You need to declare a variable for your function to return to and use it, have you read that link I gave you? It'll address all of this much better then I can.
May 12, 2011 at 9:40pm
the program is fine except fora few thing. first off the function is computeTax not computeTaxes so change the call in your main. secondly, you havent stored budgetTaxes anywhere. just returning it isnt good enough, because the variable goes out of scope once the function is ended. so instead do this in main:
 
double budgetTaxes = computeTax(monthlyIncome);
Topic archived. No new replies allowed.