Hello,

I have written code to calculate monthly payment for a loan. Now, I have to display an amortization table, which I don't know how to do. I have posted what I have written so far. Any help will be greatly appreciated. Thanks!

Code:

#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
using namespace std;
int main ()
{
//Stores variables
int loan_amount;
double interest_rate;
int loan_length;
double monthly_payment;
//Prompts for and reads loan amount
cout << "Enter the amount of the loan: ";
cin >> loan_amount;
cout << endl;
//Prompts for and reads interest rate
cout << "Enter the Annual Interest Rate: ";
cin >> interest_rate;
cout << endl;
//Prompts for and reads loan length
cout << "Please enter the length of the loan in years: ";
cin >> loan_length;
cout << endl;
//Calculate monthly payment
interest_rate = interest_rate / 1200;
monthly_payment = (interest_rate + (interest_rate/(pow (1+interest_rate, 12*loan_length)-1))) * loan_amount;
//Format output
cout << setprecision(2) << fixed << showpoint;
//Display monthly payment
cout << "The monthly payment is " << monthly_payment << endl << endl;
//Display amortization table
}