Thread: How to write/ syntax Mortgage C++ formula code needed from website

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    How 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

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    convince me its not homework for more help but look up the function pow() from <cmath>
    Last edited by Stoned_Coder; 04-04-2003 at 09:13 AM.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    I'll be honest ...

    this is for my final project for C++ programming. Appreciate the help anyways.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    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.

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    attempt 1 but not working

    loanamount = loanmopayment * (1 - pow((1 + loanrate), -loanterm)) / loanrate;

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    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!
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    you also need to think about placement of loanamount and loanmopayment. i'm assuming loanmopayment is the monthly payment and loanamount is the principle.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  2. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  3. Replies: 2
    Last Post: 02-14-2006, 11:08 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM