Posted By

Vejfil on 05/13/18


Tagged

fil


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Vejfil


bludiste


 / Published in: C++
 

bludiste

  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <conio.h>
  5. #include <stdio.h>
  6. using namespace std;
  7.  
  8.  
  9. int main(void) {
  10.  
  11. // unsigned char arrow;
  12.  
  13. int kinosal[11][11];
  14. int s = 1; // soucasny sloupec
  15. int r = 5; //soucasna rada
  16. int geners[4];
  17. int generr[4];
  18. int x = 2;
  19. // int bs = s + 1;
  20. // int br = r + 1;
  21. // int bsm = s - 1;
  22. // int brm = r - 1;
  23.  
  24.  
  25. for (int j = 0; j < 11; j++)
  26. for (int i = 0; i < 11; i++)
  27. kinosal[j][i] = 0;
  28. for (int i = 0; i < 11; i++)
  29. {
  30. kinosal[i][0] = 1;
  31. }
  32. for (int i = 0; i < 11; i++)
  33. {
  34. kinosal[0][i] = 1;
  35. }
  36. for (int i = 0; i < 11; i++)
  37. {
  38. kinosal[i][10] = 1;
  39. }
  40.  
  41. for (int i = 0; i < 11; i++)
  42. {
  43. kinosal[10][i] = 1;
  44. }
  45. kinosal[1][5] = 2;
  46. kinosal[9][5] = 3;
  47. for (int i = 0; i < 4; i++)
  48. {
  49. geners[i] = x;
  50. x = x + 2;
  51.  
  52. }
  53.  
  54. for (int i = 0; i < 4; i++)
  55. {
  56. generr[i] = x;
  57. x = x + 2;
  58. }
  59. for (int i = 0; i < 4; i++)
  60. for (int j = 0; j < 4; j++)
  61. {
  62. kinosal[geners[i]][generr[j]] = 4;
  63. }
  64.  
  65. vykresleni:
  66. system("CLS");
  67. int bs = s + 1;
  68. int br = r + 1;
  69. int bsm = s - 1;
  70. int brm = r - 1;
  71. for (int j = 0; j < 11; j++)
  72. {
  73. for (int i = 0; i < 11; i++)
  74. cout << kinosal[i][j];
  75. cout << endl;
  76. }
  77. if (kinosal[s][br] == 3 || kinosal[s][brm] == 3 || kinosal[bs][r] == 3 || kinosal[bsm][r] == 3) {
  78. cout << "Nalezli jste cil a zvitezili!! GRATULUJI!!" << endl;
  79. };
  80. char a = _getch();
  81. if (a == 's') { //dolu
  82. if (kinosal[s][br] == 0) {
  83. kinosal[s][r] = 0;
  84. kinosal[s][br] = 2;
  85. r = r++;
  86. goto vykresleni;
  87. }
  88. else { goto vykresleni;
  89. cout << "pohyb nelze provest"; }
  90. }
  91. else if (a == 'w') {//nahoru
  92. if (kinosal[s][brm] == 0) {
  93. kinosal[s][r] = 0;
  94. kinosal[s][brm] = 2;
  95. r = r--;
  96. goto vykresleni;
  97. }
  98. else { goto
  99. vykresleni;
  100. cout << "pohyb nelze provest"; }
  101. }
  102.  
  103. else if (a == 'a') { //doleva
  104. if (kinosal[bsm][r] == 0) {
  105. kinosal[s][r] = 0;
  106. kinosal[bsm][r] = 2;
  107. s = s--;
  108. goto vykresleni;
  109. }
  110. else {
  111. goto vykresleni;
  112. cout << "pohyb nelze provest"; }
  113. }
  114. else if (a == 'd') {//doprava
  115. if (kinosal[bs][r] == 0) {
  116. kinosal[s][r] = 0;
  117. kinosal[bs][r] = 2;
  118. s = s++;
  119. goto vykresleni;
  120. }
  121. else {
  122. goto vykresleni;
  123. cout << "pohyb nelze provest"; }
  124. }
  125. else
  126. {
  127. goto vykresleni;
  128. printf("%d", (int)a);
  129. }
  130.  
  131. // unsigned char ch;
  132. // while ((ch = _getch()) != 27) {
  133. // printf("%02X\n", ch);
  134. // }
  135.  
  136.  
  137. cin.get();
  138. cin.get();
  139. return 0;
  140. }

Report this snippet  

You need to login to post a comment.