So, this is the little compound interest program i wrote that is due tommorow.
As far as I can tell it should be working, but it says something about an undefined reference? All help appreciated.
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(int argc, char *argv[])
{
double computeInterest(double princ, double interest, double A, int time);
void printEarning(double A, double princ);
char go='y';
double princ, interest, A, interestEarned;
bool repeat(char go);
int time;
int n=0, m=1;
do{
cout<<"Please enter the Principle Value:"<<endl;
cin>>princ;
cout<<"Please enter the interest rate in %:"<<endl;
cin>>interest;
cout<<"Please enter the amount of time in years:"<<endl;
cin>>time;
cout<<setw(5);
cout<< "Year\tBegin Balance\tInterest Earned\tEnding Balance"<<endl;
cout<< "----------------------------------------------------"<<endl;
A=princ;
for (n=time;m<=time;++m)
{
princ=A;
cout<<m<<" "<<princ<<"\t"<<endl;
computeInterest(princ, interest, A, time);
printEarning(A, princ);
}
cout<<"Repeat program? (Y)es/(N)o"<<endl;
cin>>go;
}while(go=='y'||go=='Y')
; system("PAUSE");
return EXIT_SUCCESS;
}
double computeInterest(int princ, double interest, double A, int time)
{
A=princ*(1+interest);
A=pow(A, time);
A=A-princ;
return A;
}
void printEarning(double A, double princ)
{
cout<<A<<"\t"<<A+princ<<endl;
}