|
|
|
@ -126,16 +126,6 @@ bool complement(int board[9][9], int row, int col) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void printSudokuSolution(int matrix[9][9]) {
|
|
|
|
|
printf("The solution of Sudoku matrix:\n");
|
|
|
|
|
for (int i = 0; i < 9; i++) {
|
|
|
|
|
for (int j = 0; j < 9; j++) {
|
|
|
|
|
printf("%d ", matrix[i][j]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void output(int board[9][9]){
|
|
|
|
|
int i;
|
|
|
|
@ -159,7 +149,8 @@ int main() {
|
|
|
|
|
output(board);
|
|
|
|
|
if (check(board)) {
|
|
|
|
|
if (complement(board, 0, 0)) {
|
|
|
|
|
printSudokuSolution(board);
|
|
|
|
|
printf("The solution of Sudoku matrix:\n");
|
|
|
|
|
output(board);
|
|
|
|
|
} else {
|
|
|
|
|
printf("No solution!\n");
|
|
|
|
|
}
|
|
|
|
|