I am trying to write this formula in C++ syntax. Please see this mortgage calculator page where the formula resides. Thank you.

http://www.netjeff.com/MortgageCalculator/PNI.html

- 04-04-2003jerel2k3How to write/ syntax Mortgage C++ formula code needed from website
I am trying to write this formula in C++ syntax. Please see this mortgage calculator page where the formula resides. Thank you.

http://www.netjeff.com/MortgageCalculator/PNI.html - 04-04-2003Stoned_Coder
convince me its not homework for more help but look up the function pow() from <cmath>

- 04-04-2003jerel2k3I'll be honest ...
this is for my final project for C++ programming. Appreciate the help anyways.

- 04-04-2003alpha
that wouldn't be too tough.

you'll need about 6 variables.

and the pow function in cmath as Stoned_Coder said will also be needed. - 04-04-2003jerel2k3attempt 1 but not working
loanamount = loanmopayment * (1 - pow((1 + loanrate), -loanterm)) / loanrate;

- 04-04-2003Stoned_Coder
not quite. very nearly. you need fix the precedence issue of * and / in your code. I could tell you how but that would spoil your fun!:D

- 04-04-2003alpha
you also need to think about placement of loanamount and loanmopayment. i'm assuming loanmopayment is the monthly payment and loanamount is the principle.