Home / Essays / c++ Assignment

c++ Assignment

c++ Assignment
Project Three Part a
Points: 12
Objective:
1 Become familiar with the use of one and multidimensional arrays in C++.
2 Develop familiarity with using arrays as part of function arguments.

Description:
Write a program that solves relatively simple Sudoku puzzles. In your implementation make sure that you use arrays and not pointers. This is possible since in this particular instance, the array sizes are fixed by the nature of the problem.
Input:
Since the concept of file I/O has not been introduced yet, all data can be obtained by the way of the stdin prompt interactively. You can then feed the data to your program from a file by using file redirection. The input file will contain the initial Sudoku data with 0’s placed for the missing numbers. The data will be presented from the top left of the table to bottom right.
Output:
The final solution of the puzzle should be presented via the stdout in a matrix format (table format).
Requirements:
¥ Your program should contain one object named Sudoku that contains the following:
â—¦ A two-dimensional integer data member named: Data[9][9] â—¦ A default constructor that initializes the Data array to all 0’s (1 point)
â—¦ An alternate constructor that initializes the values of the Data array using a two-dimensional array that has been passed to the constructor. (1 points)
â—¦ A ReadPuzzle method that will prompt the user to the enter the information for the puzzle. (2 points)
â—¦ A PrintPuzzle method that will print the current content of the puzzle in a 9×9 matrix. (2 points)
â—¦ A ChechRow method that will check for the existence of a number in a given row of the puzzle. This method will return a true if the number exists and false if the number is absent. (3 points)
â—¦ A CheckCol method that will check for the existence of a number in a given column of the puzzle. This method will return a true if the number exists and false if the number is absent. (3 points).
â—¦ Here is the “mySudoku.h” file for this project that summarizes all of the above. You MUST use this .h file. You care free to add more to it, but do not change it!
¥ Your submission should include a single tar.gz file.
Notes:
Make sure that your program tests for convergence and does not get stuck in an infinite loop.
Sample puzzles:
Example1:
Sample input for the following problem
0 0 5 7 1 0 6 8 2
0 3 6 0 4 0 0 7 5
7 0 0 5 8 6 3 4 9
9 8 4 0 5 7 2 0 0
1 5 0 0 0 0 7 9 8
6 7 2 8 0 0 0 0 4
0 6 8 2 0 9 0 1 0
3 4 9 1 0 0 8 2 0
0 1 7 0 3 0 9 0 6
Staring
Ending

Example 2:
Sample input file for the following problem.
2 0 7 0 9 0 4 0 6
0 4 0 2 6 7 0 5 3
5 0 0 3 8 4 0 0 0
6 0 0 5 2 8 3 0 7
8 2 5 0 3 1 0 0 9
0 0 1 9 4 6 0 2 0
4 0 2 6 1 9 7 0 8
9 1 3 8 0 0 0 0 4
7 0 0 0 5 3 1 9 2
Starting
Ending
FOR YOUR ASSIGNMENTS TO BE DONE AT A CHEAPER PRICE PLACE THIS ORDER OR A SIMILAR ORDER WITH US NOW

Leave a Reply

WPMessenger