Here we go loopde loop!

Any help in totaling my returns variable for output? Thanks

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{

double balance, interest_rate, returns, new_balance, years, return_total;

cout << "Enter interest rate\n\n";
cin >> interest_rate;
interest_rate /= 100;
cout << "Enter amt\n\n";
cin >> balance;
cout << "Enter years\n\n";
cin >> years;



for (int i =1; i<=years; i++){

returns = balance * interest_rate;
new_balance = returns + balance;

balance = new_balance;

cout << returns << endl;


}



cout << endl;
cout << new_balance;
cout << endl;



cout << endl << endl;
system ("PAUSE");
return 0;
}
Right after "returns = balance * interest_rate;" just add "return_total += returns;"
Thanks for the help but, I can not seem to get it to work. My cout << returns << endl; is printing out all my returns, each one depending on number of years I use but I just cannot get them to total up! driving me nuts, it's right there, just can't see it.
Ahaaa! forgot to initialize return_total to 0 before loop. :) thanks!!
Topic archived. No new replies allowed.