Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. #include <iostream>
  2. #include "conio2.h"
  3. using namespace std;
  4.  
  5. #define SUDOKU_BOARD 18
  6. #define SUDOKU_SIZE 9
  7. #define HORIZONTAL_LINE 196
  8. #define VERTICAL_LINE 179
  9. #define PLUS_SIGN 197
  10.  
  11.  
  12.  
  13. ////RYSOWANIE/////
  14. void rysuj_sudoku()
  15. {
  16.    
  17.     for (int i = 0; i <=SUDOKU_BOARD; i++)
  18.     {
  19.         for (int j = 0; j <=SUDOKU_BOARD; j++)
  20.         {
  21.            
  22.             if (i == 0 || i == 6 || i == 12 || i == 18 || j == 0 || j == 6 || j == 12 || j == 18)
  23.                
  24.                 putch('#');
  25.            
  26.             else if (i % 2 == 0 && j % 2 == 0)
  27.                 putch(197);
  28.             else if (i % 2 == 0)
  29.                 putch(196);
  30.             else if (j % 2 == 0)
  31.                 putch(179);
  32.  
  33.             else cputs(" ");
  34.            
  35.         }
  36.         cout << endl;
  37.     }
  38.  
  39. };
  40.  
  41. int main()
  42. {
  43.  
  44.     int zn, x=40, y=12, attr = 7;
  45.     settitle("imie nazwisko nr_indeksu");
  46.     textbackground(BLACK);
  47.  
  48.     do {
  49.        
  50.         textcolor(7);
  51.         clrscr();
  52.        
  53.         rysuj_sudoku();
  54.         gotoxy(55, 1);
  55.         cputs("q = wyjscie");
  56.         gotoxy(55, 2);
  57.         cputs("strzalki = poruszanie");
  58.         gotoxy(55, 3);
  59.         cputs("spacja = zmiana koloru");
  60.         gotoxy(x,y);
  61.        
  62.        
  63.         textcolor(attr);
  64.         putch('@');
  65.         zn = getch();
  66.         if (zn == 0) {
  67.             zn = getch();
  68.             if (zn == 0x48) y--;
  69.             else if (zn == 0x50) y++;
  70.             else if (zn == 0x4b) x--;
  71.             else if (zn == 0x4d) x++;
  72.         }
  73.         else if (zn == ' ') attr = (attr + 1) % 16;
  74.  
  75.        
  76.        
  77.     } while (zn != 'q');
  78.  
  79.  
  80.  
  81.    
  82.  
  83.  
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement