### doing loops with Ifs..can't figure out why it wont add them up

basically im asking the user to enter numbers. IF the numbers are greater than 100, give them a discount. This part i got working fine, however i now need to add a loop and then add up the total of the discounts and print it out.
 ``1234567891011121314151617181920212223242526272829303132`` ``````# include # include int main() { int i=0; double total=0; double discBill; int amt; double disc; for(i=0;i<10;i++) { cout<>amt; disc=.10 * amt; discBill=amt - disc; if (amt < 200) { cout<<"\nthe bill is : "<

enter amount sold: 500

the discounted bill is : 451.00

the total discount for everyone is : 451.00

enter amount sold: 300

the discounted bill is : 271.00

the total discount for everyone is : 271.00

enter amount sold:

what am i doing wrong (i know my math is off) thanks!

Can't you just add each value up as you go in the current loop you have?

I don't know what you think is wrong, your program is...odd, and it doesn't even remotely match what you seem to be asking for.
well i'm lost as to what you are saying. basically at the end of the program i want it to print out the total amount of discount from the total sales.
closed account (Dy7SLyTq)
first on lines 2 and 3 remove the .h and put a c in front of the the header names. second, on line 16, it has to be 0.10 not just .10. this is because the ., when not used in math, is used for classes
Topic archived. No new replies allowed.