Guest User

Untitled

a guest
Jun 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. enum E_ELEMENTY_MAPY  {Eel_pusty = 46,       // znak '.'
  7.                        Eel_postac = 111};    // znak 'o'
  8. /*----------------------------------------------------------------------------*/
  9. const unsigned wielkosc_mapy = 15;           // wielkosc mapy                                                                
  10. E_ELEMENTY_MAPY IT_mapa [wielkosc_mapy][wielkosc_mapy];
  11. const char Start_wiersz = 0;                 // indeksy poczatkowe                          
  12. const char Start_kolumna = 0;                        
  13. /*----------------------------------------------------------------------------*/
  14. void wypelnianie_IT_mapa (void) {
  15.                         for (int i=0;i<wielkosc_mapy;i++) {
  16.                             for (int j=0;i<wielkosc_mapy;j++) {  
  17.                                 IT_mapa[j][i] = Eel_pusty; }
  18.                         }
  19.                         IT_mapa[Start_wiersz][Start_kolumna] = Eel_postac;
  20. };
  21.  /*---------------------------------------------------------------------------*/
  22. void rysuj_mape()
  23. {
  24.      char index_wierszy = 0;
  25.      char index_kolumn = 0;
  26.      system ("cls");
  27.      cout << endl << "       ";
  28.      for (int i=0;i<(wielkosc_mapy*2+1);i++)
  29.      { cout << "_"; }                      
  30.      // rysowanie lini gornej
  31.      cout << endl;
  32.      for (int i=0;i<wielkosc_mapy;i++)
  33.      {
  34.          cout << "      |";
  35.          for (int j=0;j<wielkosc_mapy;j++)
  36.          { cout << " " << static_cast<char>(IT_mapa[i][j]); }
  37.          // rysowanie elementu tablicy
  38.          cout << " |" << endl;
  39.      }
  40.      cout << "       ";
  41.      for (int i=0;i<(wielkosc_mapy*2+1);i++)
  42.      { cout << "-"; }
  43. };
  44. /*----------------------------------------------------------------------------*/
  45. int ruch(void)
  46. {
  47.      int wcisniety_klawisz = getch();
  48.      if (wcisniety_klawisz == 224) {
  49.         if (kbhit()){
  50.                     return getch();}
  51.      } else { return wcisniety_klawisz; }
  52. };
Add Comment
Please, Sign In to add comment