candyapplecorn

Cookie Clicker Lucky Minimum Bank Amount Calculator

Sep 16th, 2013
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. //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.
  2. //Candyapplecorn
  3. #include <iostream>
  4. #include <iomanip>
  5. #include <cctype>
  6. using namespace std;
  7.  
  8. void intro();
  9. void line();
  10. void getcps(float&);
  11. void calcmin(float&, float);
  12. void showmin(float);
  13. int continu();
  14. float fancyshowmin(float);
  15.  
  16. int main()
  17. {
  18. float cps, minimum;
  19. intro();
  20. do
  21. {
  22. getcps(cps);
  23. if(cps==0)
  24. break;
  25. calcmin(minimum, cps);
  26. showmin(minimum);
  27. }while(cps!=0);
  28. return 0;
  29. }
  30.  
  31. void showmin(float minimum)
  32. {
  33. cout << fixed << setprecision(0);
  34. cout << "MINIMUM COOKIES: " << minimum*10 << endl;
  35. }
  36. void calcmin(float &minimum, float cps)
  37. {
  38. minimum=cps*1200+13;
  39. }
  40.  
  41. void getcps(float &cps)
  42. {
  43. cout << "Enter your cookies per second (cps) [0 to quit]: ";
  44. while(!(cin>>cps))
  45. {
  46. cin >> cps;
  47. cin.clear();
  48. cin.ignore(100,'\n');
  49. }
  50. }
  51.  
  52. void intro()
  53. {
  54. line();
  55. 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";
  56. line();
  57. }
  58.  
  59. void line()
  60. {
  61. cout << "------------------------------------------------------\n";
  62. }
Add Comment
Please, Sign In to add comment