I was having a couple of challenges with my C++ Mortgage Calculator.
For some reason, when the Monthly Payment displays it reads, "$1.#INF"
My 'Quit' code is not working either, but my main concern is the Monthly Payment.
Here is my code:
using namespace std;
int main ()
int myMortgage = 0;
int myTerm = 0;
float myInterest = 0.000;
int months = myTerm * 12;
int quit = 1; // decides if user wants to quit
cout << "Input the total loan amount:\n";
cin >> myMortgage;
cout << "Input your interest rate:\n";
cin >> myInterest;
cout << "Input your number of years:\n";
cin >> myTerm;
monthlyPayment = (myMortgage * (myInterest / 12)) / (1 - 1 / pow ((1 + myInterest / 12), months));
cout << "Your monthly payment is: $" << monthlyPayment<< "\n";
cout << "To Enter a new Loan Amount press 1 or 2 to quit\n";
cin >> quit;
} while (quit==1);