Hi, this is my first project. Its a money change program that calculates how much change in denominations to give back.
The problem is when I input a x.x6 to x.x9 in total, the value is always slightly less than what I inputted. This is causing my program to output one less penny.
Without checking too much, your program is probably suffering rounding errors as a result of using float's. Double's might improve it but the problem doesn't go away completely until you work with integers ie cents.
Instead of $27.57 convert the amount at the start to 2757 cents and work from there. A $20.00 note is simply 2000 cents so you can still work out the change in cents then convert back at the last moment