Write a program to place ten queens on 10 x 10 chessboard in such a way that one queen is to be in each row. A program will use 2 DIMENIONAL array x[r][c] to do this configuration. If x[r] has value c, then in row r there is a queen in column c. Write a program that asks a user to enter the columns that contain queens in the ten rows. The program then places the queens in these columns (one per row) and prints the board.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.5: A Case Study: Solving Quadratic Equations
Problem 2E
icon
Related questions
Question

Write a program to place ten queens on 10 x 10 chessboard in such a way that one queen is to be
in each row. A program will use 2 DIMENIONAL array x[r][c] to do this configuration. If x[r] has
value c, then in row r there is a queen in column c. Write a program that asks a user to enter the
columns that contain queens in the ten rows. The program then places the queens in these
columns (one per row) and prints the board.

The output should be as follow (note: user input is required):
Please enter columns to put queen
1
Please enter columns to put queen
0
Please enter columns to put queen
7
Please enter columns to put queen
7
Please enter columns to put queen
0
Please enter columns to put queen
3
Please enter columns to put queen
2
Please enter columns to put queen
6
Please enter columns to put queen
8
Please enter columns to put queen
4
Q
Q
Q
Q
Transcribed Image Text:The output should be as follow (note: user input is required): Please enter columns to put queen 1 Please enter columns to put queen 0 Please enter columns to put queen 7 Please enter columns to put queen 7 Please enter columns to put queen 0 Please enter columns to put queen 3 Please enter columns to put queen 2 Please enter columns to put queen 6 Please enter columns to put queen 8 Please enter columns to put queen 4 Q Q Q Q
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage