Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Sudoku is a popular puzzle game. The goal of Sudoku is to fill a 99 grid with numbers so that each row, column and

c++

Sudoku is a popular puzzle game. The goal of Sudoku is to fill a 99 grid with numbers so that each row, column and 33 section contain all of the digits between 1 and 9. (This means that if a number is used twice in the same row, column or 33 section, some number will be missing.)

Your assignment is to write a program that verifies a Sudoku board. It should check that each row contains each number exactly once, that each column contains each number exactly once, and that each of the nine 3x3 square segments contain each number exactly once. The 3x3 square segments are outlined in the Sudoku boards shown above. You have already written the code to verify a row / column so you dont need to start from scratch! Begin by creating a 2D array to store the Sudoku board. Then populate all 9x9 elements of the array. Your program does not need to get input from the user. Part 1: Begin by writing code to verify The first row The first column The upper left 3x3 square. Hint: begin by writing code to display the upper left 3x3 square. Part 2: Then, write a separate function for each of these tasks: verify row i, where i is the row number. verify column i, where i is the column number. verify a 3x3 square beginning at row i and column j, Each of these functions should return a Boolean value to indicate if the verification succeeded or failed. Your functions should not use global variables. Each function should be passed the information it needs as parameters. Call these functions from within loops, so your code will be much more concise! Make sure to test your program with both valid and different types of invalid boards.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions