Question: ( Similar to the problem above, but the user specifies a row for each column instead of a column for each row. ) Eight queens
Similar to the problem above, but the user specifies a row
for each column instead of a column for each row. Eight queens are to be
placed on a x chessboard in such a way that one queen is to be placed in each column. Write a complete C program that does the
following:
Declare an array queenRows with capacity to represent such a configuration.
If queenRowsc has value r then in column c there is a queen in row r
The program should ask the user to enter the row that contains queens in the rows.
The program then passes array queenRows to a f
unction called printBoard that prints a D board with in the nonqueen row of each
row and Q in the queen row of each column.
Example main f
unction that uses these f
unctions:
int main
int queenRows;
cout "Enter rows for queens:
;
readInputqueenRows;
printBoardqueenRows;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
