#include <iostream>
using std::cout;
using std::endl;
using std::fixed;
#include <iomanip>
using std::setw;
using std::setprecision;
#include <cmath>
using std::pow;
int main()
{
double amount;
double principal = 1000.0;
double rate = .05;
cout << "Year" << setw( 21 ) << "Amount on deposit" << endl;
cout << fixed << setprecision( 2 );
for ( int year = 1; year <= 10; year++ )
{
amount = principal * pow( 1.0 + rate, year );
cout << setw( 4 ) << year << setw( 21 ) << amount << endl;
}
return 0;
}
Year Amount on deposit
1 1050.00
2 1102.50
3 1157.63
4 1215.51
5 1276.28
6 1340.10
7 1407.10
8 1477.46
9 1551.33
10 1628.89