Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This program takes your CPS and tells you how many cookies you should save up so that you get the maximum return from a lucky golden cookie.
- //Candyapplecorn
- #include <iostream>
- #include <iomanip>
- #include <cctype>
- using namespace std;
- void intro();
- void line();
- void getcps(float&);
- void calcmin(float&, float);
- void showmin(float);
- int continu();
- float fancyshowmin(float);
- int main()
- {
- float cps, minimum;
- intro();
- do
- {
- getcps(cps);
- if(cps==0)
- break;
- calcmin(minimum, cps);
- showmin(minimum);
- }while(cps!=0);
- return 0;
- }
- void showmin(float minimum)
- {
- cout << fixed << setprecision(0);
- cout << "MINIMUM COOKIES: " << minimum*10 << endl;
- }
- void calcmin(float &minimum, float cps)
- {
- minimum=cps*1200+13;
- }
- void getcps(float &cps)
- {
- cout << "Enter your cookies per second (cps) [0 to quit]: ";
- while(!(cin>>cps))
- {
- cin >> cps;
- cin.clear();
- cin.ignore(100,'\n');
- }
- }
- void intro()
- {
- line();
- cout << "This program calculates the amount of cookies you\nshould keep in your bank so that you get\nthe best return from a \"lucky\" golden cookie.\n";
- line();
- }
- void line()
- {
- cout << "------------------------------------------------------\n";
- }
Add Comment
Please, Sign In to add comment