Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. #include <iostream>
  2. #include<ctime>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9. srand(time(0));
  10. char mass[30][40];
  11. int a;
  12. int b;
  13. int chislo;
  14.  
  15. cout << "Hardcore-1 , Easy-2";
  16. cin >> a;
  17. if (a == 1){
  18. b = 100;
  19. }
  20. else{b = 40;}
  21. for(int i = 0 ; i < 30 ; i++){
  22. for ( int j = 0; j < 40 ; j++){
  23. mass[i][j] = '0';
  24. }
  25. }
  26. for ( int i = 0; i < b ; i++){
  27. int o = rand()%30;//здесь я просто создаю рандомные числа без этог тоже можно но по мне так удобней
  28. int a = rand()%40;
  29. mass[o][a] = '!';
  30. if (mass[o][a+1] != '!' && a + 1 < 40){mass[o][a+1]++;}
  31. if (mass[o][a-1] != '!' && a - 1 >= 0){mass[o][a-1]++;}
  32. if (mass[o+2][a] != '!' && o + 2 < 30){mass[o+1][a]++;}
  33. if (mass[o-2][a] != '!' && o - 2 >= 0){mass[o-1][a]++;}
  34.  
  35.  
  36. }
  37.  
  38.  
  39.  
  40. for(int i = 0 ; i < 30 ; i++){
  41. for ( int j = 0; j < 40 ; j++){
  42. cout << mass[i][j] << " ";
  43. }
  44. cout << endl;
  45. }
  46. lol:
  47. cout << "Now chose the plase on the field.";
  48. int m , n;
  49. cin >> m >> n;
  50. if (mass[m][n] == '!'){
  51. cout << "YOU LOOOOOOOOSER !!! YOU ARE THE WORST SAPPER!!!";// тут реакция на нажатие кнопеи
  52. //потом это надо заменить на цвета
  53. return 0;
  54. }
  55. else if (mass[m][n] == '1'){
  56. cout << "ONE IT IS NEARLY!";
  57. goto lol;
  58. }
  59. else if (mass[m][n] == '2'){
  60. cout << "TWO !!!";
  61. goto lol;
  62. }
  63. else if (mass[m][n] == '3'){
  64. cout << "THREE!!!";
  65. goto lol;
  66. }
  67. else if (mass[m][n] == '4'){
  68. cout << "FOUR!!!";
  69. goto lol;
  70. }
  71. else {cout << "ZERO!!!";
  72. goto lol;}
  73. return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement