Question: C++ Sudoku problem PLEASE show 3 files !!!! main.cpp checker.h checker.cpp Background: The purpose of this assignment is to practice dealing with string data. The
C++ Sudoku problem
PLEASE show 3 files !!!!
main.cpp
checker.h
checker.cpp
Background: The purpose of this assignment is to practice dealing with string data. The goal is to work with data declared as char * and also as string. Somehow, I think you'll like working with string much better. Please recall that string is officially known as std::string.
Project : Sudoku Row Checker Sudoku is a logic-based number placement puzzle. The objective is to fill a 99 grid so that each column, each row, and each of the nine 33 boxes (also called blocks or regions) contains the digits from 1 to 9 only one time each.
The Sudoku Row Checker class is can be used to validate a string of information. Using string operations, it should verify that each number 1 to 9 is used only one time.
Following the class diagrams shown below, implement the Sudoku Row Checker class. Embed your class in a suitable test program that proves your calculations are correct. You may choose to create any number of additional methods, but you are required to implement all of the public methods shown below. You are free to ignore the private parts of the class I suggest below.
| Implementation Details | Sample Driver Code |
| SudokuRowChecker | SudokuRowChecker checker; checker.setData( "123456789" ); if (checker.isValid()) { cout << "looks good!"; } else { cout << "looks bad!"; } checker.clear( ); checker.setStringData("12345678901"); if (checker.isValid()) { cout << "looks good!"; } else { cout << "looks bad!"; } checker.clear( ); checker.setData( "123456799" ); if (checker.isValid()) { cout << "looks good!"; } else { cout << "looks bad!"; } |
| SudokuRowChecker( ); void setData( char * s ); void setStringData( std::string s ); void clear(); bool isValid( ) const; | |
| std::string sudokuRow; | |
|
| Sample Output |
|
| looks good! looks bad! looks bad! |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
