0
int numOfMonths = numOfYears * 12;
	float monthlyRepayments;
	float actualRate = (rate/100)/12;
	//monthlyRepayments = (borrowAmount*(pow((1+actualRate),numOfMonths))*actualRate)/((pow((1+actualRate),numOfMonths))-1);
	monthlyRepayments = (100000 * (pow((1+actualRate),180) * actualRate))/((pow((1+actualRate),180))-1);

Ok this is the actual equation:
(100000*(1+A1)^180*A1)/((1+A1)^180-1)

btw A1 =0.06/12

So the commented line is original one I tried, didn't work. So I tried just putting numbers in rather than bringing them in through the function, didn't work.

If I cout << monthlyRepayments it displays this (for both): -1.#IND

Which is what the eh?

1
Contributor
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Lokolo
0

I've solved it.

actualRate = (rate/100)/12

Rate was set to an int, so actualRate was just set to 0 as the equation made it equal to 0.005, which obviously in int terms is0.

However theres no way to delete the thread. So solved it is.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.