Im doing an advanced extra credit project for my C++ class and am trying to make a Sudoku game based on function specifications laid out by the teacher. The problem is that my Display() method is not printing anything out. The idea is that I have a function that feeds a 2 dimensional array of 9x9 that holds SudCell objects into a 4 dimensional array of 3x3by3x3 that holds pointers to SudCell objects. And then I print out a 3x3 section of this array using a SectorDisplay().

Here is the complete code listing if you would like to run the program:

http://codepad.org/t72PRLDL

All the code Im listing here is from the same class except the ToString() method which is called inside the SectorDisplay() method and comes from the SudCell class that makes SudCell objects which is what the arrays hold.

Here is the Display method:

Here is the ToString() method called from the SudCell classCode:void Sudoku::SectorDisplay(int sec_row, int sec_col) { int out = 0, stop = 0; for (int x=0;x<3;x++) for (int y=0;y<3;y++) { sector[sec_row][sec_col][x][y]->ToString(); out++; if (out > 2) { cout << endl; out = 0; stop++; if (stop > 1) stop = 0; } } }

Here are what the two arrays look like:Code:string SudCell::ToString() { string output; int boolcount = 0; int whichdigit = 0; for (int x=0;x<9;x++) { if (digits[x] == true) { whichdigit = x; boolcount++; } } if (boolcount > 1 || boolcount < 1) output = " - "; else { whichdigit++; ostringstream cnvrt; cnvrt << whichdigit; output = cnvrt.str(); output = " " + output + " "; } return output; }

Here is the WireUpSectorArrays() method which feeds pointers of the suds array into the sector array:Code:SudCell* sector[SQRT_NUM_VALS][SQRT_NUM_VALS] [SQRT_NUM_VALS][SQRT_NUM_VALS]; SudCell suds[NUM_VALS][NUM_VALS];

Code:void Sudoku::WireUpSectorArrays() { int inc3 = 0, inc3acr = 0, inc3down = 0, inc3downjump = 0; for(int x=0;x<MAX_VAL;x++) for(int y=0;y<MAX_VAL;y++) { sector[inc3downjump][inc3acr][inc3down][inc3] = &suds[x][y]; //cout << sector[inc3downjump][inc3acr][inc3down][inc3]->SudCell::ToString(); inc3++; if(inc3 > 2) { inc3 = 0; inc3acr++; if (inc3acr > 2) { inc3acr = 0; inc3down ++; if(inc3down > 2) { inc3down = 0; inc3downjump++; if(inc3downjump > 2) inc3downjump = 0; } } } } }