@@ -20,8 +20,6 @@ class SudokuFrame{
2020
2121 int sudokuFrame[9 ][9 ]; // This pointer will hold all the values in the matrix.
2222 int editableFrame[9 ][9 ]; // This pointer will tell us all the values which are editable.
23- int rowIter, colIter; // iterator variables
24-
2523
2624 /* *
2725 * @desc This constructor calls the menu() func to provide the menu.
@@ -86,6 +84,8 @@ class SudokuFrame{
8684 private: void readFrameValues (){
8785 cout<<" \n Enter the specified value when prompted.\n " ;
8886 cout<<" Enter 0 if cell is empty.\n\n " ;
87+
88+ int rowIter, colIter;
8989
9090 for (rowIter=0 ; rowIter<9 ; rowIter++){ // Iterating over cells to read vals.
9191 for (colIter=0 ; colIter<9 ; colIter++){
@@ -128,6 +128,8 @@ class SudokuFrame{
128128
129129 ifstream sudokuFile; // Opening file for reading.
130130 sudokuFile.open (filename,ios::in);
131+
132+ int rowIter, colIter;
131133
132134 for (rowIter=0 ; rowIter<9 ; rowIter++){ // Iterating over file values.
133135 for (colIter=0 ; colIter<9 ; colIter++){
@@ -194,6 +196,7 @@ class SudokuFrame{
194196 */
195197 public: void clearFrameFrom (int row, int col){
196198 int jcount=0 ;
199+ int rowIter, colIter;
197200
198201 for (rowIter=row; rowIter<9 ; rowIter++){
199202
@@ -217,6 +220,7 @@ class SudokuFrame{
217220 public: void displayFrame (){
218221
219222 cout<<" ++=====================================++" ;
223+ int rowIter, colIter;
220224
221225 for (rowIter=0 ; rowIter<9 ; rowIter++){
222226 int cellIter=1 ;
@@ -395,7 +399,6 @@ class Possibilities{
395399*/
396400class SudokuSolver {
397401
398- int rowIter, colIter; // Iter variables
399402 int recursiveCount; // Stats variable
400403 SudokuFrame frame; // The frame object
401404
@@ -427,6 +430,7 @@ class SudokuSolver{
427430 * @return (bool) whether the value is valid or not in the sudoku frame
428431 */
429432 private: bool cellValueValid (int row, int col, int currentValue){
433+ int rowIter, colIter;
430434
431435 // Checking if value exists in same column
432436 for (rowIter=0 ; rowIter<9 ; rowIter++){
@@ -464,6 +468,8 @@ class SudokuSolver{
464468 int colStart=(col/3 )*3 ;
465469 int colEnd=(colStart+2 );
466470
471+ int rowIter, colIter;
472+
467473 for (rowIter=rowStart; rowIter<=rowEnd; rowIter++){
468474 for (colIter=colStart; colIter<=colEnd; colIter++){
469475 if (frame.getCellValue (rowIter,colIter)==currentValue) return false ;
0 commit comments