I know my work is sloppy, this is my 4th assignment in this class. Any help would be appreciated, thank you.
double getPrincipal(0);
double getRate(0);
double getYears(0);
double computeAmount(double getPrincipal, double getRate, double getYears);
double displayAmount(double principal, double rate, double years, double amount);
cout << "what is the principal ammount?" << endl;
cin >> getPrincipal;
cout << "What is the percentage rate?" << endl;
cin >> getRate;
cout << "Over how many years will the money stay in the bank?" << endl;
cin >> getYears;
computeAmount = pow((1 + getRate / 100),getYears); // This is where i got the error
You are messing up functions
with variables
by trying to assign a value to a function.
double computeAmount(double getPrincipal, double getRate, double getYears);
By this line, you declare computeAmount()
to be a function who takes 3 double
s as its parameters and return a double
.
But, in this line,
computeAmount = pow((1 + getRate / 100),getYears);
You're trying to use it as a variable.
Depends on what your purpose is, you may want to change one of these two lines. For example, you can delete the first line, and change the second line to:
double computeAmount = pow((1 + getRate / 100),getYears);