Advertisement
JewishCat

Untitled

Jun 23rd, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. // moo-moo.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <cstdlib>
  7. #include <math.h>
  8. #include <ctime>
  9. #include <windows.h>
  10.  
  11. using namespace std;
  12. double fRand(double fMin, double fMax)
  13. {
  14. double f = (double)rand() / RAND_MAX;
  15. return fMin + f * (fMax - fMin);
  16. }
  17. int main()
  18. {
  19. srand(time(NULL));
  20. double food = 25;
  21. int moo = 8;
  22. double eat = 0.15;
  23. double food_r = eat * moo / 2;
  24. int hunter = moo / 4;
  25. int eat_h = hunter / 4;
  26. int t = 0;
  27. do
  28. {
  29. cout << "Vvedite t-Time: ";
  30. cin >> t;
  31. } while (t<1);
  32.  
  33. for (int i = 1; i < t; i++) {
  34.  
  35. double ch_a = fRand(0.3,1);
  36. double ch_h = fRand(0.15, 0.75);
  37. if (round(ch_a)) {
  38. moo += moo / 2;
  39.  
  40. }
  41. if ((food - moo * eat) < 0) {
  42. cout << "Need food ";
  43. }
  44. break;
  45. food -= moo * eat;
  46. food += food / 3 * food_r;
  47. moo -= moo - eat_h * hunter;
  48. /*if (moo > hunter) {
  49. hunter += hunter * 2;
  50. }
  51. else {
  52. if (round(ch_a)) {
  53. hunter -= hunter - 1;
  54. }
  55. }*/
  56. }
  57. cout << moo << " " << food << " " << hunter;
  58.  
  59.  
  60.  
  61.  
  62.  
  63. system("pause");
  64. return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement