Hello there. I would like some help with my program. I am a complete noob, and I am doing a program with monthly compound interest, using a monthly deposit, a rate of interest (annual) to find the new balance. My problem is is that I can't seem to get past the first month for a value. No matter how many months I type in I cant get any other value but the first month value.
using namespace std;
double result = 0.0, rate = 0, dollars;
int months = 12;
//declare the variables
// prompt for dollars, rate etc...
//assign the value to result ( result = dollars * pow( ( 1 + rate / months ) , ( months + dollars ) ); )
result = dollars * pow( ( 1 + rate / months ) , ( months + dollars ) );
cout << "Enter monthly deposit:" <<endl;
cin >> dollars;
cout << "Enter the interest rate (in percent):" <<endl;
cin >> rate;
cout << "Enter the time (months):" <<endl;
cin >> months;
while (dollars < result)
cout << "The new balance is: " << result + rate + dollars<< endl;
Any and all help would be appreciated.
PS. The program had to be started by using the sum.cpp template. It can be found here for reference: