Counters Example
// Counters.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
#include
using std::setw;
using std::setprecision;
#include
using std::pow;
int main()
{
int x;
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;
}
cin >> x;
return 0;
}