Advertisement
MeehoweCK

Untitled

May 9th, 2023
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. enum class Pole
  6. {
  7.     puste, poszukiwacz, mur, wrog, skarb
  8. };
  9.  
  10. const short N = 30;
  11.  
  12. Pole plansza[N][N];
  13.  
  14. void wypelnij_plansze()
  15. {
  16.     for(short i = 0; i < N; ++i)
  17.         for(short j = 0; j < N; ++j)
  18.         {
  19.             if(i == 0 || j == 0 || i == N - 1 || j == N - 1)
  20.                 plansza[i][j] = Pole::mur;
  21.             else
  22.                 plansza[i][j] = Pole::puste;
  23.         }
  24.     // dopisać
  25. }
  26.  
  27. void wypisz_plansze()
  28. {
  29.     for(short i = 0; i < N; ++i)
  30.     {
  31.         for(short j = 0; j < N; ++j)
  32.             switch(plansza[i][j])
  33.             {
  34.             case Pole::puste:
  35.                 cout << ' ';
  36.                 break;
  37.             case Pole::mur:
  38.                 cout << '#';
  39.                 break;
  40.             case Pole::poszukiwacz:
  41.                 cout << '@';
  42.                 break;
  43.             case Pole::skarb:
  44.                 cout << '$';
  45.                 break;
  46.             case Pole::wrog:
  47.                 cout << '!';
  48.             }
  49.         cout << endl;
  50.     }
  51. }
  52.  
  53. int main()
  54. {
  55.     wypelnij_plansze();
  56.     wypisz_plansze();
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement