Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 KB | None | 0 0
  1.  
  2.  
  3. #include "random_crossplattform_von_roman.h"
  4. #include "gotoxy.h"
  5. #include "wait.h"
  6.  
  7.  
  8. void wuerfel(const int p_startx, const int p_starty, const int p_viereck);
  9. void eins(const int p_startx, const int p_starty, const int p_viereck);
  10. void zwei(const int p_startx, const int p_starty, const int p_viereck);
  11. void drei(const int p_startx, const int p_starty, const int p_viereck);
  12. void vier(const int p_startx, const int p_starty, const int p_viereck);
  13. void fuenf(const int p_startx, const int p_starty, const int p_viereck);
  14. void sechs(const int p_startx, const int p_starty, const int p_viereck);
  15. void punkt(int viereck);
  16. int* randomwuerfel(int p_startx, int p_starty, int p_viereck);
  17. void wuerfeln1(int p_startx, int p_starty, int p_viereck);
  18.  
  19.  
  20. int main()
  21. {
  22. gen_seed();
  23. int startx = 3;
  24. int starty = 1;
  25. const int viereck = 219;
  26. int randomnumber = get_randint(1, 6);
  27.  
  28.  
  29. wuerfeln1(startx, starty, viereck);
  30.  
  31. gotoxy(startx +50, starty + 50);
  32.  
  33. printf("%i", randomwuerfel(startx, starty, viereck)[0]);
  34. gotoxy(startx + 10, starty + 21);
  35. printf("%i", randomwuerfel(startx, starty, viereck)[1]);
  36. gotoxy(startx + 10, starty + 22);
  37. printf("%i", randomwuerfel(startx, starty, viereck)[2]);
  38. gotoxy(startx + 10, starty + 23);
  39. printf("%i", randomwuerfel(startx, starty, viereck)[3]);
  40. gotoxy(startx + 10, starty + 24);
  41. printf("%i", randomwuerfel(startx, starty, viereck)[4]);
  42. gotoxy(startx + 10, starty + 25);
  43. printf("%i", randomwuerfel(startx, starty, viereck)[5]);
  44.  
  45. return 0;
  46. }
  47.  
  48. void wuerfel(const int p_startx, const int p_starty, const int p_viereck)
  49. {
  50. int wert = 0;
  51.  
  52. //oben
  53. for (int i = 0; i < 22; i++)
  54. {
  55. gotoxy(p_startx + wert, p_starty);
  56. printf("%c", p_viereck);
  57. wert++;
  58. }
  59. wert = 0;
  60.  
  61. //unten
  62. for (int i = 0; i < 22; i++)
  63. {
  64. gotoxy(p_startx + wert, p_starty + 10);
  65. printf("%c", p_viereck);
  66. wert++;
  67. }
  68. wert = 0;
  69.  
  70. //links
  71. for (int i = 0; i < 11; i++)
  72. {
  73. gotoxy(p_startx, p_starty + wert);
  74. printf("%c", p_viereck);
  75. wert++;
  76. }
  77. wert = 0;
  78.  
  79. //links2
  80. for (int i = 0; i < 11; i++)
  81. {
  82. gotoxy(p_startx + 1, p_starty + wert);
  83. printf("%c", p_viereck);
  84. wert++;
  85. }
  86. wert = 0;
  87.  
  88. //rechts
  89. for (int i = 0; i < 11; i++)
  90. {
  91. gotoxy(p_startx + 20, p_starty + wert);
  92. printf("%c", p_viereck);
  93. wert++;
  94. }
  95. wert = 0;
  96.  
  97. //rechts2
  98. for (int i = 0; i < 11; i++)
  99. {
  100. gotoxy(p_startx + 21, p_starty + wert);
  101. printf("%c", p_viereck);
  102. wert++;
  103. }
  104. wert = 0;
  105. }
  106.  
  107.  
  108. void eins(const int p_startx, const int p_starty, const int p_viereck)
  109. {
  110.  
  111. wuerfel(p_startx, p_starty, p_viereck);
  112.  
  113. gotoxy(p_startx + 10, p_starty + 5);
  114. punkt(p_viereck);
  115.  
  116. gotoxy(p_startx + 20, p_starty + 10);
  117. }
  118.  
  119. void zwei(const int p_startx, const int p_starty, const int p_viereck)
  120. {
  121.  
  122. wuerfel(p_startx, p_starty, p_viereck);
  123.  
  124. gotoxy(p_startx + 8, p_starty + 6);
  125. punkt(p_viereck);
  126.  
  127. gotoxy(p_startx + 12, p_starty + 4);
  128. punkt(p_viereck);
  129.  
  130. gotoxy(p_startx + 20, p_starty + 10);
  131. }
  132.  
  133. void drei(const int p_startx, const int p_starty, const int p_viereck)
  134. {
  135.  
  136. wuerfel(p_startx, p_starty, p_viereck);
  137.  
  138. gotoxy(p_startx + 10, p_starty + 5);
  139. punkt(p_viereck);
  140.  
  141. gotoxy(p_startx + 6, p_starty + 3);
  142. punkt(p_viereck);
  143.  
  144. gotoxy(p_startx + 14, p_starty + 7);
  145. punkt(p_viereck);
  146.  
  147. gotoxy(p_startx + 20, p_starty + 10);
  148. }
  149.  
  150. void vier(const int p_startx, const int p_starty, const int p_viereck)
  151. {
  152.  
  153. wuerfel(p_startx, p_starty, p_viereck);
  154.  
  155. gotoxy(p_startx + 6, p_starty + 3);
  156. punkt(p_viereck);
  157.  
  158. gotoxy(p_startx + 14, p_starty + 3);
  159. punkt(p_viereck);
  160.  
  161. gotoxy(p_startx + 6, p_starty + 7);
  162. punkt(p_viereck);
  163.  
  164. gotoxy(p_startx + 14, p_starty + 7);
  165. punkt(p_viereck);
  166.  
  167. gotoxy(p_startx + 20, p_starty + 10);
  168. }
  169.  
  170. void fuenf(const int p_startx, const int p_starty, const int p_viereck)
  171. {
  172.  
  173. wuerfel(p_startx, p_starty, p_viereck);
  174. gotoxy(p_startx + 10, p_starty + 5);
  175. punkt(p_viereck);
  176.  
  177. gotoxy(p_startx + 6, p_starty + 3);
  178. punkt(p_viereck);
  179.  
  180. gotoxy(p_startx + 14, p_starty + 3);
  181. punkt(p_viereck);
  182.  
  183. gotoxy(p_startx + 6, p_starty + 7);
  184. punkt(p_viereck);
  185.  
  186. gotoxy(p_startx + 14, p_starty + 7);
  187. punkt(p_viereck);
  188.  
  189. gotoxy(p_startx + 20, p_starty + 10);
  190. }
  191.  
  192. void sechs(const int p_startx, const int p_starty, const int p_viereck)
  193. {
  194.  
  195. wuerfel(p_startx, p_starty, p_viereck);
  196.  
  197. gotoxy(p_startx + 6, p_starty + 3);
  198. punkt(p_viereck);
  199.  
  200. gotoxy(p_startx + 14, p_starty + 3);
  201. punkt(p_viereck);
  202.  
  203. gotoxy(p_startx + 6, p_starty + 5);
  204. punkt(p_viereck);
  205.  
  206. gotoxy(p_startx + 14, p_starty + 5);
  207. punkt(p_viereck);
  208.  
  209. gotoxy(p_startx + 6, p_starty + 7);
  210. punkt(p_viereck);
  211.  
  212. gotoxy(p_startx + 14, p_starty + 7);
  213. punkt(p_viereck);
  214.  
  215. gotoxy(p_startx + 20, p_starty + 10);
  216. }
  217.  
  218. void punkt(int p_viereck)
  219. {
  220. printf("%c%c", p_viereck, p_viereck);
  221. }
  222.  
  223. int* randomwuerfel(int p_startx, int p_starty, int p_viereck)
  224. {
  225. int augenzahl[6] = { 0, 0, 0, 0, 0 };
  226. int randomnumber = get_randfloat(1, 6);
  227.  
  228. if (randomnumber == 1)
  229. {
  230. eins(p_startx, p_starty, p_viereck);
  231. augenzahl[0] = randomnumber;
  232. }
  233.  
  234. if (randomnumber == 2)
  235. {
  236. zwei(p_startx, p_starty, p_viereck);
  237. augenzahl[1] = randomnumber;
  238. }
  239.  
  240. if (randomnumber == 3)
  241. {
  242. drei(p_startx, p_starty, p_viereck);
  243. augenzahl[2] = randomnumber;
  244. }
  245.  
  246. if (randomnumber == 4)
  247. {
  248. vier(p_startx, p_starty, p_viereck);
  249. augenzahl[3] = randomnumber;
  250. }
  251.  
  252. if (randomnumber == 5)
  253. {
  254. fuenf(p_startx, p_starty, p_viereck);
  255. augenzahl[4] = randomnumber;
  256. }
  257.  
  258. if (randomnumber == 6)
  259. {
  260. sechs(p_startx, p_starty, p_viereck);
  261. augenzahl[5] = randomnumber;
  262. }
  263.  
  264. return augenzahl;
  265. }
  266.  
  267. void wuerfeln1(int p_startx, int p_starty, int p_viereck)
  268. {
  269. randomwuerfel(p_startx, p_starty, p_viereck);
  270. p_startx = p_startx + 23;
  271. randomwuerfel(p_startx, p_starty, p_viereck);
  272. p_startx = p_startx + 23;
  273. randomwuerfel(p_startx, p_starty, p_viereck);
  274. p_startx = p_startx + 23;
  275. randomwuerfel(p_startx, p_starty, p_viereck);
  276. p_startx = p_startx + 23;
  277. randomwuerfel(p_startx, p_starty, p_viereck);
  278.  
  279.  
  280. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement