Advertisement
Timtsa

31.01

Jan 31st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #pragma once
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5. class RandomGenerator
  6. {
  7. public:
  8. void SetProability(int p)
  9. {
  10. probility = p;
  11. }
  12.  
  13.  
  14. bool GetEvent()
  15. {
  16. int check = rand() % 60;
  17. if (check <= probility)
  18. {
  19. return true;
  20. }
  21. return false;
  22. }
  23.  
  24.  
  25. private:
  26. int probility = 0;
  27.  
  28. };
  29.  
  30. class Car
  31. {
  32. string description;
  33. int arrivedTime;
  34.  
  35. public:
  36.  
  37. Car(string _description, int time)
  38. {
  39. description = _description;
  40. arrivedTime = time;
  41. }
  42.  
  43. Car(string _description)
  44. {
  45. description = _description;
  46. arrivedTime = 0;
  47. }
  48.  
  49. string getDescription()
  50. {
  51. return description;
  52. }
  53. int getarrivedTime()
  54. {
  55. return arrivedTime;
  56. }
  57. void ShoeCar()
  58. {
  59. cout << description << endl;
  60. }
  61. };
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. class CarMaker
  69. {
  70. string CarState[4]{ "novii","crash","pumped","sported" };
  71. string CarMarck[5]{ " Djiguli "," BMW "," Mersedes "," JEEP "," Volvo " };
  72. string CarColr[4]{ " Green"," Red"," Pink"," Blac" };
  73. public:
  74. Car MakeCar()
  75. {
  76. string description = CarState[rand() % 4] + CarMarck[rand() % 5] + CarColr[rand() % 4];
  77.  
  78. Car b(description);
  79. return b;
  80.  
  81. }
  82.  
  83.  
  84.  
  85. };
  86.  
  87.  
  88. class Quene
  89. {
  90. struct Node
  91. {
  92. Car car;
  93. Node* next;
  94.  
  95. Node(const Car& _car) : car(_car), next(nullptr) {}
  96. };
  97.  
  98. Node* pHead;
  99. Node* pTtail;
  100. public:
  101.  
  102.  
  103. Quene()
  104. {
  105. pHead = nullptr;
  106. pTtail = nullptr;
  107.  
  108. }
  109. void enque(Car _car)
  110. {
  111. if (pHead == nullptr)
  112. {
  113. pHead = new Quene::Node(_car);
  114. pTtail = pHead;
  115. }
  116. else
  117. {
  118. pTtail->next = new Node(_car);
  119. pTtail = pTtail->next;
  120. }
  121. }
  122. void deque()
  123. {
  124. pHead = pHead->next;
  125. delete pHead;
  126.  
  127. }
  128. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement