| 1 |
//============================================================================ |
| 2 |
// Name : Sudoku.cpp |
| 3 |
// Author : lst |
| 4 |
// Version : a.0 |
| 5 |
// Copyright : Your copyright notice |
| 6 |
// Description : Sudoku in C++. |
| 7 |
//============================================================================ |
| 8 |
|
| 9 |
#include <iostream> |
| 10 |
#include <cstdlib> |
| 11 |
#include <ctime> |
| 12 |
|
| 13 |
using namespace std; |
| 14 |
|
| 15 |
int table[9][9]; |
| 16 |
|
| 17 |
int main() { |
| 18 |
|
| 19 |
for(int i = 0; i < 9; i++){ |
| 20 |
table[0][i] = i + 1; |
| 21 |
} |
| 22 |
|
| 23 |
srand((unsigned int)time(NULL)); |
| 24 |
|
| 25 |
shuffle((int *)&table[0], 9); |
| 26 |
|
| 27 |
while(!put_line(1)) |
| 28 |
{ |
| 29 |
shuffle((int *)&table[0], 9); |
| 30 |
} |
| 31 |
|
| 32 |
for(int x = 0; x < 9; x++){ |
| 33 |
for(int y = 0; y < 9; y++){ |
| 34 |
cout << table[x][y] << " "; |
| 35 |
} |
| 36 |
|
| 37 |
cout << endl; |
| 38 |
} |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |