1. Engineering
  2. Computer Science
  3. complete a c console program display a 7x7 grid on...

Question: complete a c console program display a 7x7 grid on...

Question details

Complete a C++ console program

  1. Display a 7x7 grid on screen like the one shown on slide #1.

    • The ‘1’ must be randomly placed within its inner 5x5 grid.

    • The surrounding numbers 2 ~ 25 are visible to user immediately.

    • The solution must be hidden but can be shown by request with a passcode “COP3331”.

  2. User can enter a 4-digit value to place a number onto a cell. For instance, “0715” means placing “7” to the cell at the first row (row 1) and last column (column 5), and “2134” means placing “21” to the cell at the middle row (row 3) and the 2nd column from the right (column 4).

  3. User can enter “0000” to reset or undo the number placed previously and this can be repeated more than once.

  4. Invalid input with incorrect number or row/column that violates the rules results an error message and allows to re-enter.

  5. Using classes and objects is NOT required, i.e., it can be a non-OO program, but the main() should contain as few statements as possible.

  6. All code are saved in one file named 5x5puzzle.cpp.

9 5 19 15 14 12 2 312 13 4 8 9- 10 14 10 22 2019 15 17 18 18 16 24 23 21 20 25 3 16

Goal: fill numbers of 2 to 25 into the cells while the following two rules are satisfied.

  1. Consecutive numbers must be adjacent, either horizontally, vertically, or diagonally.

  2. All numbers must be placed in the corresponding row, column, or diagonal in which they appear around the border of the grid.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution