Amortization loan program

Hi I am new at programming and need help making a mortgage loan program that will display it in a table format. This is what I have so far could someone look at it and tell me what to fix? thank you
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main ()
{
int month;
int term_of_loan;
int years;
double principle;
double annual_interest_rate;
double monthly_interest_rate;
double balance;
double month_principle;
double month_paid_interest;
double monthly_payment;


cout<<"Enter the loan amount: ";
cin>> principle;
cout<<" Enter the annual interest rate: ";
cin>> annual_interest_rate;
cout<<"Enter the term of the loan in years: ";
cin>> years;
term_of_loan= years *12;
monthly_interest_rate= (annual_interest_rate/100) /12;
monthly_payment=((principle * monthly_interest_rate)/(1-1/(1+monthly_interest_rate)))pow(term_of_loan));
balance= principle - monthly_payment;
month_paid_interest= balance* monthly_interest_rate;
month_principle=monthly_payment - month_paid_interest;
month=0;
count=1

while (balance>0.0)
{
term_of_loan= years *12;
monthly_interest_rate= (annual_interest_rate/100) /12;
monthly_payment=((principle * monthly_interest_rate)/(1-1/(1+monthly_interest_rate)))pow(term_of_loan));
balance= principle - monthly_payment;
month_paid_interest= balance* monthly_interest_rate;
month_principle=monthly_payment - month_paid_interest;
}
if ((new_balance + interest_paid) < payment)
{
cout << count << ". Payment: $" << monthly_payment << " Interest: $" << monthly_paid_interest << " Principle: $" << month_principle << " Loan Balance is: $0.00" << endl;
}
else
{
cout << count << ". Payment: $" << monthly_payment << " Interest: $" << monthly_paid_interest << " Principle: $" << month_principle << " Loan Balance is: $" << balance << endl;
}
count++;

system ("pause");
return 0;
}
( P * i )( 1 + i )t / (( 1 + i )t – 1) that should be the calculation for monthly payment how would I code that?

that should be the calculation for monthly payment how would I code that?

define variables with the same names, initialize them and calculate in loop. This is straightforward enough...

Here is the short explanation and example of the whole thing, so you can follow iterations in your mind or on the paper... But here is no ready solution of course, only the task:
http://codeabbey.com/index/task_view/mortgage-calculator
Well yes I know what it should look like but how do I code the while loop for it and the table?
Topic archived. No new replies allowed.