Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- int main ()
- {
- double ammount(0),percent(0),years(0),round(0),result(0);//Yes it uses far too many variables
- while(true) //Keep’s the program running.
- {
- cout << "Please enter the ammount" << endl;
- cin >> ammount;
- cout << "Please enter the years" << endl;
- cin >> years;
- cout << "Please enter a percentage" << endl;
- cin >> percent;
- percent = percent / 100;
- while(years != 0)
- {
- round = ammount * percent * 1;
- result = result + round;
- years = years - 1;
- }
- 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.
- cout << result << endl;
- ammount = ammount + result;
- cout << ammount << endl;
- ammount,percent,years,round,result = 0,0,0,0,0; // Cleans the variables
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment