#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::ios;
using std::fixed;
#include <iomanip>
using std::setw;
using std::setprecision;
#include <cmath>// using pow in maths
int main()
{
double amount;//amount on deposit
double princible = 1000.0;//starting princible
double rate = 0.1;//record rate
//out put table column heads
cout << " YEAR " << setw(21) << " Amount on deposit " << endl;
cout << fixed << setprecision(2);//这句话到底起到什么作用,它又是怎么起作用的呢~?
//calculate
for( int year = 1; year <= 10; year++ ){
amount = princible*pow(1.0 + rate,year);
//output table row
cout << setw(4) << year
<< setw(21) << amount << endl;
}//end for
return 0;//indicate successful termination
}//end function main