Beginner C++ coding

hey guys, have an assignment due for a basic program and for some reason it doesn't seem to perform the calculations I've assigned it to when I run it... any help or feedback would be much appreciated.. thanks!


int main()
{

double est_gross_earn; //estimated gross earnings
double taxes; //amount paid to taxes
double net_income; //income after taxes are taken from gross earnings
double amt_for_clothes; //amount spent on clothing
double amt_for_school_supplies; //amount spent on school supplies
double total_savings; //amount going into savings
double amt_left_over; // amount left over to spend
Last edited on
Hey. Please use code tags for all of your code so it's readable - http://www.cplusplus.com/articles/jEywvCM9/

Lots of things to point out, to start with -

taxes = est_gross_earn * TAXRATE;
How can you calculate the taxes, when est_gross_earn has no value? You never set it to anything so it's garbage.

net_income = est_gross_earn - taxes;

Here both est_gross_earn is garbage, and taxes is garbage because non of them have any value.

amt_for_clothes = net_income * CLOTHES;
... you get the idea. Do the calculations only once the variables have values.
Topic archived. No new replies allowed.