thenuke321

Untitled

Apr 29th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9.     double ammount(0),percent(0),years(0),round(0),result(0);//Yes it uses far too many variables
  10.     while(true) //Keep’s the program running.    
  11.     {
  12.     cout << "Please enter the ammount" << endl;
  13.     cin >> ammount;
  14.     cout << "Please enter the years" << endl;
  15.     cin >> years;
  16.     cout << "Please enter a percentage" << endl;
  17.     cin >> percent;
  18.     percent = percent / 100;
  19.     while(years != 0)
  20.     {
  21.         round = ammount * percent * 1;
  22.         result = result + round;
  23.         years = years - 1;
  24.     }
  25.     cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" << endl; // This will clear things up.
  26.     cout << result << endl;
  27.     ammount = ammount + result;
  28.     cout << ammount << endl;
  29.  
  30.     ammount,percent,years,round,result = 0,0,0,0,0; // Cleans the variables
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment