Link to home
Start Free TrialLog in
Avatar of mustish1
mustish1

asked on

Needs help in output

Hi guy: Can any one please help me that why it shows only year1 why it not shows the rate of the rest of the years in the program ? Thanks.

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
      int principal = 1000;
      int years = 1;
      double balance = 0.0;
      double rate = 0.03;
      do
      {
            cout << "Year" << years << ":" << endl;
            while (rate < .06)
            {
                  balance = principal * pow(1 + rate, years);
                  cout << fixed << setprecision(0);
                  cout << " Rate " << rate * 100 << "%: $";
                  cout << setprecision(2) << balance << endl;
                  rate +=.01;
            }
            years +=1;
      }      while (years < 6);
            system("Pause");
            return 0;
}
ASKER CERTIFIED SOLUTION
Avatar of sjklein42
sjklein42
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mustish1
mustish1

ASKER

Thanks.