fork download
  1. // Cenyao Huang. CS1A Homework 5, P. 294, #5
  2.  
  3. /*******************************************************************************************************************************
  4. * CALCULATE PROJECTED RATE OF FEES
  5. *
  6. * This program calculates the projected rate of the fees for a country club membership for the next six
  7. * years.
  8. *
  9. * Input
  10. * fee : the price of the membership each year
  11. *
  12. * Output
  13. * year : the number of years projected
  14. *
  15. *******************************************************************************************************************************/
  16.  
  17. #include <iostream>
  18. using namespace std;
  19.  
  20. int main() {
  21. // Data dictionary
  22. int fee, year;
  23.  
  24. // Calculate and display fees
  25. for (fee = 2500, year = 1; year <= 6; fee =fee + (fee *0.04), ++year)
  26. cout << "The fee for year " << year << " is $" << fee << endl;
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
The fee for year 1 is $2500
The fee for year 2 is $2600
The fee for year 3 is $2704
The fee for year 4 is $2812
The fee for year 5 is $2924
The fee for year 6 is $3040