Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Microsoft Visual Studio, write a program that includes a class called Sudoku for generating and solving Sudoku puzzles. The class should contain the following

Using Microsoft Visual Studio, write a program that includes a class called Sudoku for generating and solving Sudoku puzzles. The class should contain the following public member functions: Sudoku::Sudoku(int n) Populates n squares of the 9x9 matrix with legal values int Sudoku::solve() Produces a valid solution to the generated puzzle (returns 1 on success, 0 on failure) void Sudoku::printGrid() Prints the 9 x 9 grid The program should begin by asking for an initial number of squares to randomly (and legally) populate. The initialized grid should then be printed, using * for undetermined values. The program then tries to find a solution. If a valid solution is found, the solution is then printed to the screen. Otherwise, the message Sorry, unsolvable is printed. Submit a .zip file to Canvas that contains three files: main.cpp, sudoku.cpp, and sudoku.h. An example of a main.cpp file looks like this:

#include "sudoku.h" #include using namespace std; int main() { int n; cout << "Welcome to SudokuSolver!!" << endl; cout << "Enter number of squares to prepopulate: "; cin >> n; Sudoku s(n); if (s.solve()) { cout << "Solved!" << endl; s.printGrid(); } else { cout << "Sorry, unsolvable..." << endl; } return 0; }

Any help would be appreciated!! Thanks!!

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago