Advertisement
lordspart

Untitled

Mar 24th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <ctime>
  4. #include <vector>
  5. #include <algorithm>
  6.  
  7. int smallest, second, third, fourth, biggest;
  8.  
  9.  
  10. int main()
  11. {
  12. int one, two, three, four, five, last;
  13. srand(unsigned int(time(NULL)));
  14. int wb[70];
  15. int rb[27];
  16.  
  17. for (int i = 1; i < 70; i++)
  18. {
  19. wb[i] = i;
  20. }
  21. for (int a = 1; a < 27; a++)
  22. {
  23. rb[a] = a;
  24. }
  25. one = wb[rand() % 69 + 1];
  26. two = wb[rand() % 69 + 1];
  27. while (two == one)
  28. {
  29. two = wb[rand() % 69 + 1];
  30. }
  31. three = wb[rand() % 69 + 1];
  32. while ((three == two) || three == one)
  33. {
  34. three = wb[rand() % 69 + 1];
  35. }
  36. four = wb[rand() % 69 + 1];
  37. while (((four == one) || four == two) || four == three)
  38. {
  39. four = wb[rand() % 69 + 1];
  40. }
  41. five = wb[rand() % 69 + 1];
  42. while ((((five == four) || five == three) || five == two) || five == one)
  43. {
  44. five = wb[rand() % 69 + 1];
  45. }
  46. last = rb[rand() % 26 + 1];
  47.  
  48. std::cout << one; std::cout << std::endl;
  49. std::cout << two; std::cout << std::endl;
  50. std::cout << three; std::cout << std::endl;
  51. std::cout << four; std::cout << std::endl;
  52. std::cout << five; std::cout<<std::endl; std::cout << std::endl;
  53.  
  54.  
  55. if (one < two)
  56. {
  57. smallest = one;
  58. second = two;
  59.  
  60. }
  61.  
  62. else if (one > two)
  63. {
  64. smallest = two;
  65. second = one;
  66.  
  67. }
  68.  
  69.  
  70. if (three < smallest)
  71. {
  72. third = second;
  73. second = smallest;
  74. smallest = three;
  75.  
  76.  
  77. }
  78.  
  79. else if (three < second)
  80.  
  81. {
  82. third = second;
  83. second = three;
  84. }
  85. else if (three > second)
  86.  
  87. {
  88. third = three;
  89.  
  90. }
  91. if (four < smallest)
  92. {
  93.  
  94.  
  95. fourth = third;
  96. third = second;
  97. second = smallest;
  98. smallest = four;
  99. }
  100.  
  101. else if (four < second)
  102. {
  103. fourth = third;
  104. third = second;
  105. second = four;
  106. }
  107.  
  108.  
  109. else if (four < third)
  110. {
  111. fourth = third;
  112.  
  113. third = four;
  114. }
  115.  
  116. else if (four > third)
  117. {
  118. fourth = four;
  119. }
  120.  
  121.  
  122. if (five < smallest)
  123. {
  124.  
  125. biggest = fourth;
  126. fourth = third;
  127. third = second;
  128. Second = smallest;
  129. smallest = five;
  130. }
  131. else if (five < second)
  132. {
  133.  
  134. biggest = fourth;
  135. fourth = third;
  136. third = second;
  137. second = five;
  138.  
  139. }
  140. else if (five < third)
  141. {
  142. biggest = fourth;
  143. fourth = third;
  144. third = five;
  145.  
  146. }
  147. else if (five < fourth)
  148. {
  149.  
  150. biggest = fourth;
  151. fourth = five;
  152.  
  153. }
  154. else if (five > fourth)
  155. {
  156. biggest = five;
  157.  
  158. }
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165. std::cout << smallest; std::cout << std::endl;
  166. std::cout << second; std::cout << std::endl;
  167. std::cout << third; std::cout << std::endl;
  168. std::cout << fourth; std::cout << std::endl;
  169. std::cout << biggest; std::cout << std::endl;
  170. return 0;
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement