Advertisement
clorophilla

Sudoku

Oct 26th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int grid[9][9];
  7.  
  8. void limpar_tela()
  9. {
  10.     if (system ("cls"))
  11.     {
  12.         system ("reset");
  13.     }
  14.     else
  15.     {
  16.         system("cls");
  17.     }
  18. }
  19.  
  20. void mostrar_grid()
  21. {
  22.     int x;
  23.     cout << "   1   2    3   4   5   6   7   8   9" << endl << "   ----------------------------------- " << endl;
  24.     for (x=0; x<9;x++)
  25.     {
  26.         cout << x+1 << " | " << grid[x][0] << "   " << grid[x][1] << "   " << grid[x][2] << " | " << grid[x][3] << "   " << grid[x][4] << "   " << grid[x][5] << " | " << grid[x][6] << "   " << grid[x][7] << "   " << grid[x][8] << " | " << endl;
  27.         if ((x==2) || (x==5) || (x==8))
  28.         {
  29.             cout << "   ----------------------------------- " << endl;
  30.         }
  31.     }
  32. }
  33.  
  34.  
  35.  
  36.  
  37. int main()
  38. {
  39.     limpar_tela();
  40.     mostrar_grid();
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement