yearly interest calculator c++ using for loop
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
void main()
{
// Inputs //
double princ = 0.0;
double rate = 0.0;
int years = 0;
int year = 1;
double total = 0.0;
// Ask User For INFO //
cout << "What is the principle? ";
cin >> princ;
cout << "What is the rate in decimal? ";
cin >> rate;
cout << "how many years? ";
cin >> years;
for (double total; total = princ*(1+rate)*year;)
{
cout << "The balance after year " << year << " is "<< total << endl << endl;
year += 1;
}
while((years + 1)!= year);
system("pause");
}