Jul 17, 2009 at 7:44pm UTC
Here's my code so far:
float total(float subTotal)
{
cout.precision(4);
float taxes;
float grandTotal;
float tax;
tax = .06;
taxes = subTotal * tax;
grandTotal = taxes + subTotal;
cout << "Taxes: $" << taxes << endl;
cout << endl;
cout << "Your grand total is: $" << grandTotal << endl;
return (grandTotal);
}
My problem is that sometimes the tax displays as something like 0.12 and then sometimes it displays as something like 0.7223.
Can anyone help me?
Jul 17, 2009 at 8:25pm UTC
I'm rather new myself but as far as I know you have set the code to display the next 4 digits meaning it will display 0.0000 but if you put
that will only show the next 2 digits e.g 0.00
Hope this helps but remember im new myself
also at the top where you have written
1 2
float total(float subTotal)
I would put something like
Last edited on Jul 17, 2009 at 8:28pm UTC
Jul 17, 2009 at 8:36pm UTC
sorry for trashing, this will be kinda offtop post...
@DragonKnight - I'm quite newb too and i don't feel any shame about it
Even if we both are damn wrong about the solution NOONE will insult you here, and that's great about this forum - only serious people here...
Why i wrote this? well... I have a comparision to other c++ forums (especially my native ones)
Jul 17, 2009 at 9:00pm UTC
It's just that I have had many a bad experience on other c++ forums, some people in this world seem to get such a kick out of putting others down.
Thanks though John, as your right this site has been nothing but welcoming so far!! :-)
Jul 17, 2009 at 11:49pm UTC
Thank you all very much for your help.