I tried coding it.The only part left is verifying a 3x3 box and verifying if the digits are valid.I don't get errors when compiling,but when I run the executable file,after entering the digits,I receive an error report with the "send and don't send options".
Code:
#include<stdio.h>
#include<string.h>
int main() {
char input[81];
int board[9][9];
int row;
int col;
int x,y;
printf("Enter 81 consecutive digits for a sudoku board: ");
scanf("%s", &input);
void displayValid() {
printf("Valid sudoku board");
}
for(col = 0; col < 9; col++)
if(col != x && board[x][col] == board[x][y])
printf("Not a valid sudoku board");
for(row = 0; row < 9; row++)
if(row != x && board[row][y] == board[x][y])
printf("Not a valid sudoku board");
for(x = 0;x < 9; x++)
for(y = 0;y < 9;y++)
if(board[x][y] != 0)
printf("Not a valid sudoku board");
for(x = 0;x < 9;x++)
for(y = 0;y < 9;y++)
if((board[x][y] < 0) || (board[x][y] > 9))
printf("Not a valid sudoku board");
for(x = 0;x < 9;x++)
for(y = 0;y < 9;y++)
if(board[x][y] != 0)
printf("Not a valid sudoku board");
else {
displayValid();
}
getche();
return 0;
}