"If while" statements problem
When I run this program, it lets me enter in all the variables, but then it starts a new line and won't do anything else. Not sure what the deal is.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <iostream>
using namespace std;
int main ()
{
double months=0, beginning_balance, interest_rate, set_payment_amount, new_balance;
cout << "Enter your account balance.";
cin >> beginning_balance;
cout << "Enter the interest rate.";
cin >> interest_rate;
cout << "Enter your monthly payment amount.";
cin >> set_payment_amount;
while (new_balance > 0)
{
new_balance=beginning_balance+beginning_balance*interest_rate-set_payment_amount;
months=months+1;
}
cout << "Total number of months needed to pay off debt is ";
cout << months << "\n";
return 0;
}
|
Topic archived. No new replies allowed.