I am trying to create a sudoku generator in turbo c++ for a project. This code is not working for some reason....Please help!
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int chkcol(int u[x][y]);
int chkrow(int v[x][y]);
int chkbox(int w[x][y]);
void main()
{
textcolor(WHITE);
textbackgroundcolor(MAGENTA);
clrscr();
int sudoku[9][9];
for(int i=0; i<9; i++)
{
for(int j=0; j<9; j++)
{
int check=0;
randomize();
while(check==0)
{
sudoku[i][j]==(random(9)+1)
if (chkcol(A[i][j])=1 && chkrow(A[i][j])=1 && chkbox(A[i][j])=1)
check++;
}
}
}
int puzzle[9][9];
for(int k=0; k<=20; k++)
{
int count==0;
randomize();
while(count==0)
{
int x=random(9)+1, y=random(9)+1;
if (puzzle[x][y]='\0')
{puzzle[x][y]=sudoku[x][y];
count++;}
}
}
for(int m=o; m<9; m++)
{
cout<<" | ";
for(int n=0; n<9; n++)
cout<<puzzle[m][n]<<" | ";
cout<<endl;
}
cout<<"Press any key to display the solution";
getch();
for(int p=o; p<9; p++)
{
cout<<" | ";
for(int q=0; q<9; q++)
cout<<sudoku[p][q]<<" | ";
cout<<endl;
}
}
int chkrow(int u[x][y])
{
int found==o
for (int i=y-1;i>=0; i++)
{ if(u[x][y]==u[x][i])
found++;
}
for (int j=y+1;j<9;j++)
{ if(u[x][y]==u[x][j])
found++;
}
if(!found)
return(1);
else
return(0);
}
int chkcol(int v[x][y])
{
int found==o
for (int i=x-1;i>=0; i++)
{ if(u[x][y]==u[i][y])
found++;
}
for (int j=x+1;j<9;j++)
{ if(u[x][y]==u[j][y])
found++
}
if(!found)
return(1);
else
return(0);
}
int chkbox(int w[x][y])
{
if(x>=0 && x<=2 && y>=0 && y<=2)
{ int found==0;
for(int a=0; a<=2; a++)
{ for(int b=0; b<=2; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=3 && x<=5 && y>=0 && y<=2)
{ int found==0;
for(int a=3; a<=5; a++)
{ for(int b=0; b<=2; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=6 && x<=8 && y>=0 && y<=2)
{ int found==0;
for(int a=6; a<=8; a++)
{ for(int b=0; b<=2; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=0 && x<=2 && y>=3 && y<=5)
{ int found==0;
for(int a=0; a<=2; a++)
{ for(int b=3; b<=5; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=3 && x<=5 && y>=3 && y<=5)
{ int found==0;
for(int a=3; a<=5; a++)
{ for(int b=3; b<=5; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=6 && x<=8 && y>=3 && y<=5)
{ int found==0;
for(int a=6; a<=8; a++)
{ for(int b=3; b<=5; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=0 && x<=2 && y>=6 && y<=8)
{ int found==0;
for(int a=0; a<=2; a++)
{ for(int b=6; b<=8; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else if(x>=3 && x<=5 && y>=6 && y<=8)
{ int found==0;
for(int a=3; a<=5; a++)
{ for(int b=6; b<=8; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
else
{ int found==0;
for(int a=6; a<=8; a++)
{ for(int b=6; b<=8; b++)
{ if(x!=a || y!=b)
{ if(w[x][y]==w[a][b])
found++;
}
}
}
}
if(!found)
return(1);
else
return(0);
}