Hey, I am a total newbie I need help finding errors in my code.
// Week 4 Individual Assignment
// Calculate the monthly payment User input.
// Include header files
#include <iostream>
#include <iomanip>
#include <math.h>
using std::cout;
using std::endl;
using std::cin;
using std::ios;
//Namespaces
using namespace std;
//Declare and initialize variables
double Amount;
double Term;
double Interest;
double MnthPayment;
double rPayments;
double newAmount;
double loanPrinciple;
double loanAmount;
double cMnthInterest;
double MnthAmount;
int m = 0;
int main()
{
double mInterest;
double mTerm;
bool indic=false;
char repeat;
do
{
//Data Entry
cout << "Loan amount: ";
cin >> Amount;
cout << endl << "Interest rate: ";
cin >> Interest;
cout << endl << "Term of the loan in years: ";
cin >> Term;
//cout << endl<< Fetching <<endl << endl;
mInterest = Interest/(12*100);
mTerm = Term * 12;
// Calculate the payment
MnthPayment = (Amount * pow((1 + mInterest), mTerm)* mInterest)/(pow((1 + mInterest),mTerm)-1.0);
// Print out for calculations
cout << "The mortgage payment:$" << MnthPayment <<"\n";
//prompt for repeat
cout <<"Would you like to calculate another loan?" << endl
<<"Please enter Y to repeat or any other key to exit: ";
cin >> repeat;
cout << endl;
while (m < rPayments)
//Math to figure out values for table
MnthPayment = Interest * mInterest;
Amount = MnthPayment - cMnthInterest;
newAmount = loanPrinciple - MnthAmount;
loanAmount = newAmount;
// Controling the size length of text
if(m % 12 == 0)
{
cout<<"Enter to continue";
cin.get();
cout<<endl<<endl;
cout<<setw(18)<<"Interest";
cout<<setw(21)<<"New Principle"<<endl<<endl;
}
m++;
//Table
cout<<setw(4)<<m;
cout<<setw(20)<<setiosflags(ios:fixed)<<setprecision(2)<<cMnthInterest<<setw(22)<<loanAmount<<endl;
//assign user input value to control variable
if (repeat == 'y' || repeat == 'Y') indic = true;
else
{
cout << endl <<"Thank you for using the Mortgage Calculator"
<< endl << endl;
indic = false;
}
}while(indic == true);
return 0;
} // end