fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6. int main(){
  7.  
  8. double rate, principle, total;
  9. int iTime;
  10.  
  11. cout << "Enter the amount of money that they started off with: ";
  12. cin >> principle;
  13.  
  14. cout << "\n What is the interest rate on the money that you invested: ";
  15. cin >> rate;//5 /100
  16.  
  17. cout << "\nHow long is the money going to be invested: ";
  18. cin >> iTime;
  19.  
  20. rate /= 100;
  21.  
  22. total = (principle)* pow((1+rate), iTime);
  23.  
  24. cout << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setprecision(2);
  25. cout << "$" << total;
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 2860KB
stdin
10000
10
2
stdout
Enter the amount of money that they started off with: 
 What is the interest rate on the money that you invested: 
How long is the money going to be invested: $12100.00