Don't like ads? PRO users don't see any ads ;-)
Guest

Labirynt

By: Piomek on Jun 22nd, 2012  |  syntax: C++  |  size: 0.67 KB  |  hits: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2.  
  3. #define WYSOKOSC 20
  4. #define SZEROKOSC 20
  5.  
  6. enum Map
  7. {
  8.         Puste = 0;
  9.         Sciana = 1;
  10. }
  11.  
  12. Map map[SZEROKOSC][WYSOKOSC];
  13. /* Warto zrobić to zmienną globalną aby wszystkie funkcje miały do tego dostęp */
  14.  
  15. int main()
  16. {
  17.         /* Zamaluj całą mapę */
  18.         for (int i = 0; i < SZEROKOSC; i++)
  19.                 for (int j = 0; j < WYSOKOSC; j++)
  20.                         map[i][j] = Sciana;
  21.  
  22.         // Tutaj jakieś operacje
  23.  
  24.         /* Wyświetl mapę */
  25.         for (int i = 0; i < SZEROKOSC; i++)
  26.         {
  27.                 for (int j = 0; j < WYSOKOSC; j++)
  28.                 {
  29.                         if (map[i][j] == Sciana)
  30.                                 std::cout << "#";
  31.                         else
  32.                                 std::cout << " ";
  33.                 }
  34.                 std::cout << std::endl; /* Przejście do nowej linii */
  35.         }
  36.  
  37.         return 0;
  38. }