ok, i had to write a loan amortization program for my c++ class which, for those of you who don't know, displays a monthly chart of loan information. anyway i have it running a loop and each time the loop runs it assigns the current balance to the previous balance minus how much was paid off. like this kinda:
balance = balance - prin_pay (prin_pay is the amount paid off)
all of these variables are floats. my problem is that each time the loop runs, the balance gets a few cents higher than it should. this problem gets very large as the loop progresses. if i do the above math by hand it comes out correct, but for some reason the program screws it up. is it rounding and then adding the rounded values or something?? anyways, how do i fix this because the program is due tomorrow?