fork download
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<math.h>
  4. using namespace std;
  5.  
  6. int main () {
  7.  
  8. int time, counter, range;
  9. double investment, rate, balance;
  10.  
  11. cout << "Investment amount: " << endl;
  12. cin >> investment;
  13. cout << "Rate: " << endl;
  14. cin >> rate;
  15. cout << "Length of time: " << endl;
  16. cin >> time;
  17. cout << "Incremental Range: " << endl;
  18. cin >> range;
  19.  
  20. balance = 0;
  21. counter = 0;
  22.  
  23.  
  24. cout << "\n\n\nRate \t 5 Years \t 10 Years \t 15 Years \t 20 Years \t 25 Years \t 30 Years \n" << endl;
  25. cout << fixed << setprecision(2);
  26.  
  27.  
  28. while(counter < 6)
  29. {
  30. counter = counter + 1;
  31.  
  32. balance = investment * pow((1+ rate/100), time);
  33.  
  34. cout <<"abc"<< setw(2)<<"def" << rate << "Hello " << setw(12) <<"bye"<< balance;
  35.  
  36. time = time + range;
  37. }
  38.  
  39. cout << endl;
  40.  
  41.  
  42. return 0;
  43. }
Success #stdin #stdout 0s 2688KB
stdin
Standard input is empty
stdout
Investment amount: 
Rate: 
Length of time: 
Incremental Range: 



Rate 	 5 Years 	 10 Years 	 15 Years 	 20 Years 	 25 Years 	 30 Years 

abcdef0.00Hello          bye0.00abcdef0.00Hello          bye0.00abcdef0.00Hello          bye0.00abcdef0.00Hello          bye0.00abcdef0.00Hello          bye0.00abcdef0.00Hello          bye0.00