My program don't add up ? Eg 0.5+0.2+0.2+0.1 not equal to 1

Problem Solved!!! Thanks for helping guys
Last edited on
if(total_User_pay==1)

You shouldn't compare equalities with double or float type data.
The binary representation it's not exact, you've got trunc error. Instead of 1 you get 0,99999.

Use an epsilon to compare, round your number or try to work with integers
Last edited on
Also
avoid using goto.
main must return int.
when posting code, please use code tags
Topic archived. No new replies allowed.