Trouble Coding Compound Interest
I'm trying to calculate compound interest using the formula A = P(1 + r/12)^(12t) My error code is saying the compoundInterest must return a value but Visual Studio isn't telling me which line the error is. #include <iostream> #include <math.h> using namespace std; double compoundInterest(double P, double r, int t); int main (void) { double P, r; int t; cout << "This app is used to calculate the compound interest in an account. " << endl; cout << "Enter the principal in the account: " << endl; cin >> P; cout << "Enter the annual rate for the account as a percent: " << endl; cin >> r; cout << "Enter the time in number of years: " << endl; cin >> t; cout << "Balance of account after interest: " << compoundInterest( P, r ,t) << endl; return 0; } double compoundInterest(double P, double r, int t) { double A = P * pow(1 + r / 12, 12); system("pause"); }