01: #include <iostream>
02: #include <cmath>
03: using namespace std;
04:
05: double balance;
06: /**
07: Accumulates interest in the global variable balance
08: @param p the interest rate in percent
09: @param n the number of periods the investment is held
10: */
11: void future_value(int p, int n)
12: { balance = balance * pow(1 + p / 100, n);
13: }
14:
15: int main()
16: { balance = 10000;
17: future_value(5, 10);
18: cout << "After ten years, the balance is "
19: << balance << "\n";
20: return 0;
21: }