//sudoku solver
#include <iostream>
#include <time.h>
int array[9][9];
void FillSudoku();
int FindNumber(int,int);
using namespace std;
int main ()
{
// declarations
int sum = 0;
for (int i=0; i<9; i++)
{for (int j=0; j<9; j++)
array[i][j] = FindNumber(i,j);
}
// cout the sudoku
for (int i=0; i<9; i++)
{for (int j=0; j<9; j++)
cout << array[i][j] << " ";
cout << endl;}
// the end
system ("PAUSE");
return 0;
}
void FillSudoku()
{
srand(time(0));
int x;
for (int i=0; i<9; i++)
for (int j=0; j<9; j++)
{ do {x = rand(); } while(x>9 || x<1);
array[i][j] = x;}
}
int FindNumber(int i,int j)
{ int a = 1;
for (int i=0; i<9; i++)
if (array[i][j]==a)
a++;
for (int j=0; j<9; j++)
if (array[i][j]==a)
a++;
return a;
}