Project #83414 - c++

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 9x9 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




“mySudoku.h” File:



/*
 * File:   mySudoku.h
 * Author:
 *
 * Created on September 21, 2015, 12:53 PM
 */

#ifndef MYSUDOKU_H
#define    MYSUDOKU_H

const int Size(9);

class mySudoku {
public:
    mySudoku(); // 1 point
    mySudoku(int anArray[][Size]); // 1 points
    mySudoku(const mySudoku& orig);
   
    void ReadPuzzle(); // 2 points
    void PrintPuzzle(); // 2 points
    bool CheckRow(int row, int number); // 3 points, return true if the number exists
    bool CheckCol(int col, int number); // 3 points, return true if the number exists
    virtual ~mySudoku();
private:
    int Data[Size][Size];
};

#endif    /* MYSUDOKU_H */


Subject Computer
Due By (Pacific Time) 09/26/2015 06:00 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy