i have a homework
my homework is to place 8 quenns pieces from the game of chess
on a chessboard so that no queen piece is threatening another queen on the board.All of the solutions can be found using a recursive algorithm.The algorithm works by placing queens on various positions,adding one queen at a time until either eight queens have been placed on the chess board or less than eight queens are on the board but there are no more safe positions left on the board.When the latter situation is reached the algorithm backtracks and tries another layout of queen.
that is my homework
i thought declaring an array like that int a[8][8] and put 2 for queen and put 1 to threatining place into this array
i wrote the function that puts 1 for threatining place after putting the queen the function is this
int fill(int i,int j){
int a[8][8];
while(i<8){
i++;
a[j]=1;
}
while(i>=0){
i--;
a[j]=1;
}
while(j<8){
j++;
a[j]=1;
}
while(j>=0){
j--;
a[j]=1;
}
while(i<8&&j<8){
i++;j++;
a[j]=1;
}
while(i>=0&&j>=0){
i--;j--;
a[j]=1;}}

but the problem is putting the queens with a recursive function
how can i put the queens with a recursive function
please help me

Your question will be answer shortly. In the meanwhile please do
read this short guide on how to tag your code properly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.