Helping to get past for the first month for monthly copound interest program

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.

#include <iostream>
#include <cmath>

using namespace std;

int main()

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 ) ); )

//print result

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;

return 0;

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:
My project is due for tomorrow and I can't figure it out.
Topic archived. No new replies allowed.