Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++......Eight Queens with “Fancy Print” Chessboard Write C++ program Modify the

ID: 675104 • Letter: C

Question

C++......Eight Queens with “Fancy Print” Chessboard

Write C++ program

Modify the Eight Queens program (1 dimensional array – no goto version) so that it prints out a chessboard with some “fancy” representation of a queen in the appropriate positions.

How to do it:

In class we went over the code to print out a chessboard. You need to:

1. Augment that code by adding two additional “box”es, wq which represents a picture of a queen placed in a “white” square, and bq, representing a picture of a queens placed in a “black” square.

2. After the code that fills the array board[8][8] with the addresses of bb and wb, insert code to change eight entries in that array to reflect the positions of eight queens on the board. You will get these positions from a one dimensional array q[8] representing a solution to the eight queens problem. The change that you make in these eight places is to replace the pointer in board for one representing either a wq, or bq, as appropriate for that position. You know the eight positionsbecause, given q[i], i represents the column and q[i] represents the row. You can tell whether its black or white by looking at the row and column indexes of its position on the board.

3. The code described above (in 2.) goes into the print function. You pass the arrays q and board to print. In the function you

• modify board using q

• print the picture of the board

• “Clean up” array board, by restoring its original values, to get ready for the next call to print.

Explanation / Answer

CODE :

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote