``````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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.