Error in Output : C++ Carpet Store - c++

I am working on an assignment in C++ but i am relatively new to the C++ programming language, however, I am getting errors in my output.
Question
The manager of the Crosswell Carpet Store has asked you to write a program to print customers’ bills. The manager has given you the following information:
The length and width of a room are expressed in terms of meters and centimeters. For example, the length might be reported as 16.7 meters.
The store does not sell fractions of a meter. Thus, the length and width must always be rounded up.
The carpet charge is equal to the number of square meters purchased times the carpet cost per square meter. Sales tax equal to 14% of the carpet cost must be added to the bill.
The labour cost is equal to the number of square meters purchased times R24.00, which is the labor cost per square meter. No tax is charged on labour.
Each customer is identified by a five-digit number, and that number should appear on the bill. Large-volume customers, identified by a customer number starting with a '0', may be given a discount. The discount applies to the cost before sales tax is added.
The sample output follows:
CROSWELL CARPET STORE STATEMENT
Customer name : xxxxx
Customer number : xxxxx
Carpet price : xx.xx
Labour : xx.xx
Subtotal : xx.xx
Less discount : xx.xx
Subtotal : xx.xx
Plus tax : xx.xx
Total : xx.xx
And my answer to this question is as follows:
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
using namespace std;
int calculateCarpetSize (int length, int width)
{
int carpetSize;
carpetSize = ceil(length * width);
return carpetSize;
}
float calculateCarpetCost (int carpetSize , float sellingPrice)
{
float carpetCost;
carpetCost = carpetSize * sellingPrice;
return carpetCost;
}
float calculateLabourCost(int carpetSize)
{
float labourCost;
labourCost = carpetSize * 24.00;
return labourCost;
}
bool qualifyForDiscount(string customerNo)
{
string dis = "0";
if (customerNo.compare(0, dis.length(), dis) == 0)
{
return true;
}
else{
return false;
}
}
float computeDiscount ()
{
int discountPercentage;
float discount;
cout << "Enter the Percetage Discount: ";
cin >> discountPercentage ;
discount = discountPercentage / 100;
return discount;
}
void printCustomerStatement(string customerName, string customerNo, float carpetCost, float labourCost, float discount)
{
float subtotal = carpetCost + labourCost - discount;
float vat = subtotal*0.14;
cout << "\n CROSWELL CARPET STORE"<<endl;
cout << " STATEMENT"<<endl;
cout << "Customer name : "<<customerName<<endl;
cout << "Customer number : "<<customerNo <<'\n'<<endl;
cout << "Carpet price : "<<carpetCost<<endl;
cout << "Labour : "<<labourCost <<'\n'<<endl;
cout << "Subtotal : "<<carpetCost+labourCost<<endl;
cout << "Less discount : "<<discount <<'\n'<<endl;
cout << "Subtotal : "<<subtotal<<endl;
cout << "Plus Tax : "<<vat<<endl;
cout << "Total : "<<subtotal - vat<<endl;
}
int main()
{
string customerName;
string customerNo;
float carpetSize;
float sellingPrice;
float length;
float width;
float carpetCost;
float labourCost;
float discount;
cout <<"ENTER CUSTOMER NAME:";
cin >>customerName;
cout <<"ENTER CUSTOMER NUMBER:";
cin >>customerNo;
cout <<"ENTER ROOM WIDTH:";
cin >>width;
cout <<"ENTER ROOM LENGTH:";
cin >>length;
cout <<"ENTER SELLING PRICE:";
cin >>sellingPrice;
calculateCarpetSize(length, width);
calculateCarpetCost(carpetSize, sellingPrice);
calculateLabourCost(carpetSize);
if(qualifyForDiscount(customerNo))
{
computeDiscount();
}else
{
discount = 0.00;
}
printCustomerStatement(customerName, customerNo, carpetCost, labourCost, discount);
return 0;
}
I think the problem may be my function or my datatypes, or perhaps both.
EDIT
I get an output of this sort
ENTER CUSTOMER NAME:Quatban
ENTER CUSTOMER NUMBER:02234
ENTER ROOM WIDTH:20
ENTER ROOM LENGTH:20
ENTER SELLING PRICE:35
ENTER DISCOUNT PERCENTAGE: 2
CROSWELL CARPET STORE
STATEMENT
Customer name : Quatban
Customer number : 02234
Carpet price : 1.4e+004
Labour : 9.6e+003
Subtotal : 2.4e+004
Less discount : 0
Subtotal : 2.4e+004
Plus Tax : 3.3e+003
Total : 2e+004

First
Thus, the length and width must always be rounded up
Which means your function calculateCarpetSize should look more like :
int calculateCarpetSize (float length, float width)
{
int carpetSize;
carpetSize = ceil(length) * ceil(width);
return carpetSize;
}
Then
In your main :
calculateCarpetSize(length, width);
calculateCarpetCost(carpetSize, sellingPrice);
calculateLabourCost(carpetSize);
You should be storing the result of these functions like :
carpetSize = calculateCarpetSize(length, width);
carpetCost = calculateCarpetCost(carpetSize, sellingPrice);
labourCost = calculateLabourCost(carpetSize);
Edit
This actually gives you as output :
ENTER CUSTOMER NAME:Quatban
ENTER CUSTOMER NUMBER:02234
ENTER ROOM WIDTH:20
ENTER ROOM LENGTH:20
ENTER SELLING PRICE:35
Enter the Percetage Discount: 2
CROSWELL CARPET STORE
STATEMENT
Customer name : Quatban
Customer number : 02234
Carpet price : 14000
Labour : 9600
Subtotal : 23600
Less discount : 0
Subtotal : 23600
Plus Tax : 3304
Total : 20296
This looks like your (expected ?) result, even if I believe the last line should be subtotal + tax and not subtotal - tax but I may be wrong.

Related

C++ Problem: [Error] statement cannot resolve address of overloaded function x2

I'm a complete noob here in need of help. I'm hoping you guys, who are more experienced than me, can help me out.
Any input is greatly appreciated.
Here is how the code is supposed to go since it's too long:
#include <iostream>
using namespace std;
class Payslip
{
string name, pay_grade;
float salary, oth, otp, gross, net, tax, sss, pagibig, philhealth;
public:
void payslipdetails()
{
// Extremely long, but this part of the code would allow me to allow user to input their names, their base salary, and overtime hours.
sss = 500;
pagibig = 200;
philhealth = 100;
otp = oth * (salary*0.01);
gross = salary + otp;
net = gross - (tax + sss + pagibig + philhealth);
// then a series of if/else if condition if salary is greater/less than or equals to, and we divide the said salaries into pay grade A or B.
/* Example:
if (salary >= 10000 && salary <= 19999)
{
// Pay grade A
if (salary >= 10000 && salary <= 14999)
{
pay_grade = "A";
}
// Pay grade B
else if (salary >= 15000 && salary <= 19999)
{
pay_grade = "B";
}
tax = gross * 0.10;
}*/
}
}
void display_details()
{
cout<<"\n Employee Name : " << name;
cout<<"\n Basic Salary : " << salary;
cout<<"\n Pay Grade : " << pay_grade;
cout<<"\n No. of OT hours : " << oth;
cout<<"\n OT Pay : " << otp;
cout<<"\n Gross Pay : " << gross;
cout<<"\n Withholding Tax : " << tax;
cout<<"\n Net Pay : " << net;
}
};
int main()
{
Payslip d;
d.payslipdetails;
d.display_details;
return 0;
}
There is an error in d.payslipdetails and d.displaydetails. I hope this is more clear than my last post!
The error is: [Error] statement cannot resolve address of overloaded function
I'm not sure how to do this...
Are you possibly trying to call a method at the object d? Then you need at least add parentheses. as for each function call:
d.payslipdetails();
Check the method name
paySlipDetails(); provide any requred parameters as per implementation code of Payslip class.

What am I doing wrong with this mortgage formula?

#include <iostream>
#include <cmath>
using namespace std;
/* FINDS AND INITIALIZES TERM */
void findTerm(int t) {
int term = t * 12;
}
/* FINDS AND INITIALIZES RATE */
void findRate(double r) {
double rate = r / 1200.0;
}
/* INITALIZES AMOUNT OF LOAN*/
void findAmount(int amount) {
int num1 = 0.0;
}
void findPayment(int amount, double rate, int term) {
int monthlyPayment = amount * rate / ( 1.0 -pow(rate + 1, -term));
cout<<"Your monthly payment is $"<<monthlyPayment<<". ";
}
This is the main function.
int main() {
int t, a, payment;
double r;
cout<<"Enter the amount of your mortage loan: \n ";
cin>>a;
cout<<"Enter the interest rate: \n";
cin>>r;
cout<<"Enter the term of your loan: \n";
cin>>t;
findPayment(a, r, t); // calls findPayment to calculate monthly payment.
return 0;
}
I ran it over and over again, but it still gives me the incorrect amount.
My professor gave us an example that goes like this:
Loan=$200,000
Rate=4.5%
Term: 30 years
And the findFormula() function is supposed to produce $1013.67 for the mortgage payment. My professor gave us that code as well (monthlyPayment = amount * rate / ( 1.0 – pow(rate + 1, -term));). I'm not sure what's wrong with my code.
The formula may be fine, but you are not returning, nor using, any value from your conversion functions, so its inputs are wrong.
Consider this refactoring of your program:
#include <iostream>
#include <iomanip> // for std::setprecision and std::fixed
#include <cmath>
namespace mortgage {
int months_from_years(int years) {
return years * 12;
}
double monthly_rate_from(double yearly_rate) {
return yearly_rate / 1200.0;
}
double monthly_payment(int amount, double yearly_rate, int years)
{
double rate = monthly_rate_from(yearly_rate);
int term = months_from_years(years);
return amount * rate / ( 1.0 - std::pow(rate + 1.0, -term));
}
} // end of namespace 'mortgage'
int main()
{
using std::cout;
using std::cin;
int amount;
cout << "Enter the amount of your mortage loan (dollars):\n";
cin >> amount;
double rate;
cout << "Enter the interest rate (percentage):\n";
cin >> rate;
int term_in_years;
cout << "Enter the term of your loan (years):\n";
cin >> term_in_years;
cout << "\nYour monthly payment is: $ " << std::setprecision(2) << std::fixed
<< mortgage::monthly_payment(amount, rate, term_in_years) << '\n';
}
It still lacks any checking of the user inputs, but given the values of your example, it outputs:
Enter the amount of your mortage loan (dollars):
200000
Enter the interest rate (percentage):
4.5
Enter the term of your loan (years):
30
Your monthly payment is: $ 1013.37
The slightly difference from your expected output (1013,67) could be due to any sort of rounding error, even a different overload of std::pow choosen by the compiler (since C++11, the integral parameters are promoted to double).

Obtaining incorrect data using class object in different class

hey guys im writing a loan program here using two classes. I declare an object from my "MortCalc" Class in My LoanOfficer Class. The loan officer class is to determine whether a user qualifies for a loan or not a user enters the principal of a loan, monthly income, and monthly expenses. The Loan officer class then does a calculation and reports back to the user if the loan was approved using one rule. The rule is this: if the monthly payment of the loan( which is obtained from my MortCalc Class) and monthly expenses total is greater than 50% of the monthly income then the loan is not approved. The problem I've encountered is with calculating this. I try to store the calculation in a "rule" variable but it always equals 100 thus never approving the loan! obviously im doing something wrong here but i can't figure out what. here is my code:
LoanOfficer.h
class LoanOfficer
{
//private class variables
private:
MortCalc mc;
double intRate;
double monthlyIncome;
double term;
double monExpenses, principal;
double rule;
bool bLoanApprove, bOpen;
string userName, fileName,lenderName;
string loanOfficer, Welcome;
int counter;
void calculate();
LoanOfficer.cpp
LoanOfficer::LoanOfficer()
{
//initializing variables;
intRate = 4.1;
term = 30;
counter=1;
principal=0;
lenderName="John's Bank";
Welcome ="";
calculate();
}
void LoanOfficer::calculate()
{
rule = ((mc.GetMonPymt() + monExpenses) / monthlyIncome)* 100;
//i have a getter in my Mortcalc class which get's the monthly Payment.
}
bool LoanOfficer::isApproved()
{
if(rule>50)
{
bLoanApprove = true;
}
else{
bLoanApprove = false;
}
return bLoanApprove;
}
string LoanOfficer::getApproval()
{
if(bLoanApprove==true)
{
stringstream ss;
ss<<"\n\nLoan Approval Status: Yes"
<<"\nLoan amount: "
<<principal
<<"\nInterest Rate: "
<<intRate
<<"\nMonthly Payment: "
<<monPayment
<<"\nTotalLoan: "
<<mc.GetTotalLoan()
<<"\nTotal Interest"
<<mc.GetTotalInt()
<<"\n\nCongratulations We're looking to do business with you "
<<userName<<"!";
loanOfficer = ss.str();
}
else
{
stringstream ss;
ss<<"\n\nLoan Approval Status: No"
<<"\n\n Income vs Montly Payment and expenses does not meet "
<<"\n the 50% criteria net income that is necessary for this"
<<"\n institution to approve this loan";
loanOfficer = ss.str();
}
return loanOfficer;
}
void LoanOfficer::setPrincipal(double p)
{
mc.setPrin(p);
principal = p;
}
bool LoanOfficer::isOpen()
{
return bOpen;
}
void LoanOfficer::setMonInc(double mi)
{
monthlyIncome = mi;
}
void LoanOfficer::setExpenses(double ex)
{
monExpenses = ex;
}
void LoanOfficer::setAppName(string n)
{
userName = n;
}
string LoanOfficer::getFilename()
{
return fileName;
}
string LoanOfficer::getIntro()
{
stringstream ss;
ss<<"Hi Welcome to " <<lenderName
<<"\n Please enter your information below to see if you're approved for a loan."
<<"\nWe have a fixed interest rate of 4.1 and term of loan is 30 years."
<<"\nThe way we determine our loan approvals is by adding
loan payment and monthly expenses,"
<<"\nand that is greater than 50% of your monthly income the loan
is notapproved.\n\n";
Welcome = ss.str();
return Welcome;
}
void LoanOfficer::writeStatus()
{
stringstream ss;
ss<<userName<<"_"<<counter<<".txt";
fileName = ss.str();
ofstream receiptOut;
receiptOut.open(fileName.c_str());
//Writing report setting precision to 2 decimal places
//returning true if able to write receipt.
receiptOut<<" CUSTOMER LOAN INFORMATION "
<<month+1<<"/"<<day<<"/"<<year+1900<<"\n\n"
<<"********************************"
<<"\n Your Loan Information: "
<< "\n\n Principal: "<<"$" << fixed << setprecision (2)
<< principal
<< "\n\n Interest rate: "<< fixed << setprecision (2)
<< intRate << "%"
<< "\n\n Monthly Payment: "<<"$" << fixed << setprecision (2)
<< mc.GetMonPymt()
//here it obtains the correct monthly payment. I've checked through
//debugging.
<< "\n\n Total Interest paid: " <<"$"<< fixed << setprecision (2)
<< mc.GetTotalInt()
<<"\n\n Total Cost of the Loan: "<<"$" << fixed << setprecision (2)
<< mc.GetTotalLoan()
<<"\n*********************************"
<<"\n\n\nThank You for using my calculator. Have a Nice Day."
<<"\n****************************************************";
receiptOut.close();
counter++;
}
main.cpp
double principal,monthlyIncome,monthlyExpenses;
string name, answer;
string fAnswer
//class object
LoanOfficer lo;
cout<<lo.getIntro();
cout<<"Please enter your name: ";
cin>>name;
//passing name to setName class method.
lo.setAppName(name);
//start of do loop
do
{
//presenting the user a menu accessed from otherFunctions.cpp
//checking which choice user entered with switch statements
cout<<"\nPlease enter the amount you want to borrow: ";
cin>>principal;
cin.ignore();
lo.setPrincipal(principal);
cout<<"\nPlease enter your monthly income after taxes: ";
cin>>monthlyIncome;
cin.ignore();
lo.setMonInc(monthlyIncome);
cout<<"\nPlease enter your monthly expenses: ";
cin>>monthlyExpenses;
cin.ignore();
lo.setExpenses(monthlyExpenses);
cout<<lo.getApproval();
cout<<"\n\n Would you like to write a file? Enter y for yes and n for no\n";
cin>>fAnswer;
if(fAnswer =="y")
{
lo.writeStatus();
cout<<"\n\nReport is located in: "
<<lo.getFilename();
}
else
{
cout<<"\n\nNo report printed out.";
}
//ask if user would like to do another
cout<<"\n\nWould you like to do another loan? Enter y for yes and n for no\n";
cin>>answer;
cout<<"\n";
}while(answer =="y");
//end do/while
//Goodbye message
{
cout <<"\n Thanks for calculating. Goodbye!\n\n"; //when loop is done
}
return 0;
}
Change business logic!
You idea contradicts to your realization.
Let`s look closer at this statement in you question:
"The rule is this: if the monthly payment of the loan( which is obtained from my MortCalc Class) and monthly expenses total is greater than 50% of the monthly income then the loan is not approved. " and find place in your code where this business logic is implemented, here it is:
bool LoanOfficer::isApproved()
{
if(rule>50)
{
bLoanApprove = true;
}
else{
bLoanApprove = false;
}
from the code extract one can easily find that it contradicts your business logic.
Solution:
bool LoanOfficer::isApproved()
{
if(rule>50)
{
return false;
}
return true;

Cant figure out how to calculate individual students totals in a loop

I am having an issue with this program. I need it to ask for a user id then ask for book code and then the cost of a book. An individual can enter an unknown number of books. the program needs to then calculate the individual students book total and then ask another student who does the same. the program must then display the grand totals and total number of books. I cant seem to figure out what to use to be able to keep track of the individual students entries. I would be able to do this from what I was reading about arrays. But we are not to that point yet. The professor wants us to do this with a loop. I am so lost, any help would be awesome.
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
//Declare Variables.
int student_id;
char book_code;
float book_cost;
float tax_amount;
float book_subtotal;
const int SENTINEL = -9999;
const double TAX = .07;
float total_book_cost;
int number_books;
int total_books_sold;
double grand_total;
//Set Variables to Zero.
number_books = 0;
total_book_cost = 0.00;
grand_total = 0.00;
//Set Decimal to two places.
cout << fixed << showpoint;
cout << setprecision(2);
//Input Data
cout<<"Please enter your Student ID, then press enter."<<endl;
cin>>student_id;
while (student_id != SENTINEL){
cout<<"Please enter your Book Code, then press enter."<<endl;
cin>>book_code;
cout<<"Please enter the cost of the book, then press enter."<<endl;
cout<<"$"; cin>>book_cost;
tax_amount = book_cost * TAX;
book_subtotal = book_cost + tax_amount;
total_book_cost += book_subtotal;
number_books++;
cout<<"\tStudent Textbook Purchases Report"<<endl;
cout<<"********************************************"<<endl;
cout<<"Student"<<"\tBook"<<"\tBook"<<"\tTax"<<"\tBook"<<endl;
cout<<"Id"<<"\tCode"<<"\tCost"<<"\tAmount"<<"\tSubtotal"<<endl;
cout<<"--------------------------------------------"<<endl;
cout<<student_id<<setw(5)<<book_code<<setw(8)<<"$"<<book_cost<<
setw(3)<<"$"<<tax_amount<<setw(4)<<"$"<<book_subtotal<<endl;
cout<<endl;
cout<<"Total number of books purchased:"<<setw(8)<<number_books<<endl;
cout<<"Total books cost including tax:"<<setw(9)<<"$"<<total_book_cost<<endl;
cout<<"Please enter your Student ID, then press enter."<<endl;
cin>>student_id;
}
grand_total += total_book_cost;
total_books_sold += number_books;
cout<<"**************************************************"<<endl;
cout<<"Grand Totals:"<<endl;
cout<<"Total number of students who purchased books:"<<endl;
cout<<"Total number of books sold:"<<endl;
cout<<"Total cost of all books and taxes:"<<setw(9)<<"$"<<grand_total<<endl;
//Can put grand totals here
system("Pause");
return 0;
}
You could use the loop as this:
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
//Set Decimal to two places.
cout << fixed << showpoint;
cout << setprecision(2);
int total_books_sold = 0;
double grand_total = 0.0;
const int SENTINEL = -9999;
int student_id = SENTINEL;
//Input Data
cout<<"Please enter your Student ID, then press enter."<<endl;
cin>>student_id;
while (student_id != SENTINEL){
double total_book_cost = 0.0;
int number_books = 0;
char book_code = '\0';
while (true)
{
cout<<"Please enter your Book Code, then press enter."<<endl;
cin>>book_code;
if (book_code == 'x')
break;
float book_cost;
cout<<"Please enter the cost of the book, then press enter."<<endl;
cout<<"$"; cin>>book_cost;
const double TAX = .07;
double tax_amount = book_cost * TAX;
double book_subtotal = book_cost + tax_amount;
total_book_cost += book_subtotal;
number_books++;
cout<<"\tStudent Textbook Purchases Report"<<endl;
cout<<"********************************************"<<endl;
cout<<"Student"<<"\tBook"<<"\tBook"<<"\tTax"<<"\tBook"<<endl;
cout<<"Id"<<"\tCode"<<"\tCost"<<"\tAmount"<<"\tSubtotal"<<endl;
cout<<"--------------------------------------------"<<endl;
cout<<student_id<<setw(5)<<book_code<<setw(8)<<"$"<<book_cost<<
setw(3)<<"$"<<tax_amount<<setw(4)<<"$"<<book_subtotal<<endl;
cout<<endl;
};
grand_total += total_book_cost;
total_books_sold += number_books;
cout<<"Total number of books purchased:"<<setw(8)<<number_books<<endl;
cout<<"Total books cost including tax:"<<setw(9)<<"$"<<total_book_cost<<endl;
cout<<"Please enter your Student ID, then press enter."<<endl;
cin>>student_id;
}
cout<<"**************************************************"<<endl;
cout<<"Grand Totals:"<<endl;
cout<<"Total number of students who purchased books:"<<endl;
cout<<"Total number of books sold:"<<endl;
cout<<"Total cost of all books and taxes:"<<setw(9)<<"$"<<grand_total<<endl;
//Can put grand totals here
system("Pause");
return 0;
}

Loan calculator alteration

I created a program that calculates loans, but it doesn't go under the guidelines of what my professor asked. Can show me the correct alteration. Source Code would be awesome and time saving, but you don't have to.
Heres the problem:
Write a program that lets the user enter the loan amount and the loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, with an increment of 1/8. Heres a sample run:
Loan amount: 10000 [Enter]
Numbers of Years: 5: [Enter]
Interest rate Monthly Payment Total Payment
5% 188.71 11322.74
5.125% 189.28 11357.13
Heres my previous code:
# include <iostream>
# include <iomanip>
# include <cmath>
using namespace std;
int main ()
{
double loanAmountA;
double annualRate;
double paymentAmount;
double amountInterest;
double ratePeriod;
double balanceAfter;
double amountApplied;
double balance;
double paymentPeriod;
int paymentsPerYear;
int totalPayments;
int loanCount = 1;
int paymentCount = 1;
bool anotherLoan = true;
char response;
while (anotherLoan == true)
{
cout<<"Enter amount of loan A:$ ";
cin>>loanAmountA;
cout<<endl;
cout<<"Enter annual percentage rate (APR): "<<"%";
cin>>annualRate;
cout<<endl;
cout<<"Enter the number of payments per year: ";
cin>>paymentsPerYear;
cout<<endl;
cout<<"Enter the total number of payments: ";
cin>>totalPayments;
cout<<endl;
cout<<"Payment Payment Amount Amount to Balance after";
cout<<endl;
cout<<"Number Amount Interest Principal This Payment";
cout<<endl;
cin.ignore(80,'\n');
while (paymentCount <=totalPayments)
{
annualRate = annualRate / 100;
balance = loanAmountA - totalPayments * paymentAmount;
ratePeriod = balance * annualRate;
paymentAmount = loanAmountA * (totalPayments / paymentsPerYear * annualRate) / totalPayments;
balanceAfter = balance - paymentAmount;
balance = loanAmountA - (paymentCount * paymentAmount);
cout<<left<<setprecision(0)<<setw(3)<<paymentCount;
cout<<setw(13)<<left<<fixed<<setprecision(2)<<paymentAmount;
cout<<setw(26)<<left<<fixed<<setprecision(2)<<ratePeriod;
cout<<setw(39)<<left<<fixed<<setprecision(2)<<balance;
cout<<setw(42)<<left<<fixed<<setprecision(2)<<balanceAfter;
if (paymentCount % 12 == 0)
{
cout<<endl;
cout<<"Hit <Enter> to continue: "<<endl;
cin.ignore(80,'\n');
cin.get();
}
paymentCount++;
loanCount++;
cout<<endl;
}
cout<<"Would you like to calculate another loan? y/n and <enter>";
cin>>response;
if (response == 'n')
{
anotherLoan = false;
cout<<endl<<endl;
cout<<"There were"<<loanCount<< "loans processed.";
cout<<endl<<endl;
}
}
return 0;
}
Did you try to use the debugger, and find the point of failure?