Error to Infinite Loop!!!
Should have been: Sorry!?!
//Project 8 - pg380#16 Reads amount of a loan, annual interest rate, &
//monthly payment. Then displays the payment number, interest for that
//month, the balance remaining after that payment, & total internest
//paid to date in a table with appropriate headings
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std; //introduces namespace std
void LoanCalc(double, double, double);//prototype
double main( double, double, double )
{
double a, b, c;
char YorN;
do
{
cout << "What is the loan amount?\n";
cin >> a; //loan amount
cout << "What is the is annnual interest rate as decimal?\n";
cin >> b; //annual interest rate
cout << "What is the amount of monthly payment?\n";
cin >> c; //monthly payment
LoanCalc(a, b, c);
cout << "\n\nEnter Y to do another, N to stop.\n\t\t";
cin >> YorN;
}
while (YorN=='Y'||YorN=='y');
return 0;
}
void LoanCalc(double a, double b, double c)//function definition
{
cout << "\n\tPymt #\t\tMon's Int\tBalance\t\tTot Int Pd\n";
cout << "\t==========================================\ n";
cout << fixed << showpoint << right << setprecision(2);
double Balance = a;
int count = 0;
for(;;)
{
count ++;
double MonIntRate = b / 12;
double MonInt = a * MonIntRate;
double PrinPymt = c - MonInt;
double TotIntPd = TotIntPd + MonInt;
double Balance = Balance - PrinPymt;
cout << count << "\t" << MonInt << "\t" << Balance << "\t" << TotIntPd << "\n";
if(Balance <= c) cout << "\tLast Pymt\t" << Balance + (Balance * MonIntRate) << "\t"
<< (Balance + (Balance * MonIntRate)) + TotIntPd;
else break;
}
}
Why does it keep posting the same way?
Why does my message keep posting with a smiley face right after the for with only one semi-colon and no ")" at the end. Is it trying to tell me something?