i'm having problems with this code. it's supposed to be a simple loan calculator i had to fix, but i can't get it to work. my freinds told me it wasn't possable to complete using 'catch', 'try' and 'throw' (not using throw), so i attempted to fix it with that.
here is the code:
#include <iostream>
#include <iomanip>
using namespace std;
void prog(int rtestart)
{
double InterestRate, LoanInput, LoanTotal;
int choice, creastart = 0;
cout <<"\t\t\tSIMPLE LOAN CALCULATOR\n";
do {
try{
system("cls");
cout <<"To determine fixed interest on a loan, please answer the following and press ‘enter':\n";
cout <<"How much do you want to borrow?\n";
cin >> noboolalpha >> LoanInput;
}
catch(char)
{
cout << "exception occured. want to try again?" << endl;
cout << system("pause") << " or press CTRL+C to quit!" << endl;
creastart++;
while(creastart = 1)
{int restart(); creastart = 0;}
}
cout <<"What is the current interest rate from the lending institute?\n";
cin >>InterestRate;
cout <<"Your total repayment of principal + loan is:\n";
LoanTotal=(LoanInput * InterestRate/100);
cout <<fixed<<setprecision(2)<<"$"<<LoanTotal+LoanInput<<endl;
system("pause");
cout <<"Do you wish to use the program again? Y/N \n";
cin >> choice;
}
while(choice=='Y' || choice=='y');
}
int main()
{
int creastart = 1;
while(creastart = 1)
{int restart(); creastart = 0;}
i am only getting 1 error. which is the following:
g:\visual studio 2008\projects\test23a\test23a\test23a.cpp(49) : fatal error C1075: end of file found before the left brace '{' at 'g:\visual studio 2008\projects\test23a\test23a\test23a.cpp(44)' was matched
it is pointing to the following line: #include <iostream>
how do i fix this?