Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // moo-moo.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <cstdlib>
- #include <math.h>
- #include <ctime>
- #include <windows.h>
- using namespace std;
- double fRand(double fMin, double fMax)
- {
- double f = (double)rand() / RAND_MAX;
- return fMin + f * (fMax - fMin);
- }
- int main()
- {
- srand(time(NULL));
- double food = 25;
- int moo = 8;
- double eat = 0.15;
- double food_r = eat * moo / 2;
- int hunter = moo / 4;
- int eat_h = hunter / 4;
- int t = 0;
- do
- {
- cout << "Vvedite t-Time: ";
- cin >> t;
- } while (t<1);
- for (int i = 1; i < t; i++) {
- double ch_a = fRand(0.3,1);
- double ch_h = fRand(0.15, 0.75);
- if (round(ch_a)) {
- moo += moo / 2;
- }
- if ((food - moo * eat) < 0) {
- cout << "Need food ";
- }
- break;
- food -= moo * eat;
- food += food / 3 * food_r;
- moo -= moo - eat_h * hunter;
- /*if (moo > hunter) {
- hunter += hunter * 2;
- }
- else {
- if (round(ch_a)) {
- hunter -= hunter - 1;
- }
- }*/
- }
- cout << moo << " " << food << " " << hunter;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement