Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <string>
- using namespace std;
- class RandomGenerator
- {
- public:
- void SetProability(int p)
- {
- probility = p;
- }
- bool GetEvent()
- {
- int check = rand() % 60;
- if (check <= probility)
- {
- return true;
- }
- return false;
- }
- private:
- int probility = 0;
- };
- class Car
- {
- string description;
- int arrivedTime;
- public:
- Car(string _description, int time)
- {
- description = _description;
- arrivedTime = time;
- }
- Car(string _description)
- {
- description = _description;
- arrivedTime = 0;
- }
- string getDescription()
- {
- return description;
- }
- int getarrivedTime()
- {
- return arrivedTime;
- }
- void ShoeCar()
- {
- cout << description << endl;
- }
- };
- class CarMaker
- {
- string CarState[4]{ "novii","crash","pumped","sported" };
- string CarMarck[5]{ " Djiguli "," BMW "," Mersedes "," JEEP "," Volvo " };
- string CarColr[4]{ " Green"," Red"," Pink"," Blac" };
- public:
- Car MakeCar()
- {
- string description = CarState[rand() % 4] + CarMarck[rand() % 5] + CarColr[rand() % 4];
- Car b(description);
- return b;
- }
- };
- class Quene
- {
- struct Node
- {
- Car car;
- Node* next;
- Node(const Car& _car) : car(_car), next(nullptr) {}
- };
- Node* pHead;
- Node* pTtail;
- public:
- Quene()
- {
- pHead = nullptr;
- pTtail = nullptr;
- }
- void enque(Car _car)
- {
- if (pHead == nullptr)
- {
- pHead = new Quene::Node(_car);
- pTtail = pHead;
- }
- else
- {
- pTtail->next = new Node(_car);
- pTtail = pTtail->next;
- }
- }
- void deque()
- {
- pHead = pHead->next;
- delete pHead;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement