#include #include using namespace std; /** Accumulates interest in the local variable balance @param p the interest rate in percent @param n the number of periods the investment is held */ double future_value(double initial_balance, double p, int n) { double r = initial_balance * pow(1 + p / 100, n); return r; } int main() { cout << "Please enter the interest rate in percent:"; double r; cin >> r; double balance = future_value(10000, r, 10); cout << "After ten years, the balance is " << balance << "\n"; return 0; }