// check.cpp - checks (parts of) Sudoku puzzle for legality // YOUR NAME(S), DATE #include using namespace std; // global constants to return from your check functions const int PERFECT = 2; const int OKAY = 1; const int ILLEGAL = 0; const int UNDONE = -1; // REQUIRED: COMPLETE okRow TO RETURN EITHER OKAY OR ILLEGAL. // OPTIONAL: OR RETURN PERFECT IF THE ROW IS PERFECT. int okRow(int row[]) { return UNDONE; } // OPTIONAL: SAME AS ABOVE BUT FOR COLUMN k OF puzzle. int okColumn(int puzzle[9][9], int k) { return UNDONE; } // DO NOT CHANGE ANYTHING BELOW int main() { int puzzle[9][9]; char *result[] = {"illegal", "okay", "perfect"}; // fill array with data from user cout << "enter 81 puzzle values in row order:\n"; for (int i=0; i<9; i++) for (int j=0; j<9; j++) { cin >> puzzle[i][j]; if (cin.fail()) { cout << "bad or incomplete data\n"; return 1; } } // print checks of all rows if okayRow function done for (int i=0; i<9; i++) { int r = okRow(puzzle[i]); if (r >= 0 && r <= 2) cout << "row " << i << " is " << result[r] << endl; } // print checks of all columns if okayColumn done for (int i=0; i<9; i++) { int r = okColumn(puzzle, i); if (r >= 0 && r <= 2) cout << "column " << i << " is " << result[r] << endl; } return 0; }