2D Array Help C++
<p>OK so heres the scoop: I am building a minesweeper style program for my c++ class, I'm using a 2D array to create the board,and a second 2d array to store guesses. For each value in the board array, I run a random number gen and assign it a value between 0 and 99. Each value in the array is considered a bomb if its value is greater than 85. The program accepts user input and determines if it is a bomb. If it is not the corresponding bool array (isGuessed) position is changed to true. This bool array is then sent to the reDraw function to be redrawn. All false bools are displayed as '?' and all true are displayed as 'X'. However, when I reDraw, it changes multiple locations in the array to an X with only one guess. My thought is that the board is not drawn in connection with the array positions. Could someone help. Just to be clear, I'm trying to understand why the function reDraw is not working properly. Here is ALL my code. </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;ctime&gt;
#include &lt;cstdlib&gt;

using namespace std;

//Function Prototypes 

void reDraw (bool guessed [] [10], int rows, int columns);
void newBoard (int rows, int columns);


int main(int argc, const char * argv[])
{
 //Declare Variables
  const int ROWS = 10;
  const int COLUMNS = 10;
int board [ROWS][COLUMNS];
bool wasGuessed [10] [10];
bool playAgain = true;
char newGame; 
int rowGuess, columnGuess, numOfBombs = 0, score = 0; 
bool bomb = false;
srand((unsigned) time(0));


// Welcome User, Give Direction

cout&lt;&lt;"\n\n\t\tWelcome To Matt's Minesweeper\n\n";

while (playAgain) {



 //function to randomly populate array elements
    for (int row = 0; row &lt; ROWS; row++) {
        for (int column = 0; column &lt; COLUMNS; column++) {
            board [row] [column] = rand() % 100; 
            if (board [row] [column] &gt;= 85) {  //counter for bombs
                numOfBombs++;
        }
    }
}

// Create a new Display Board
newBoard(10, 10);

//Begin Game
cout&lt;&lt;"\nTotal Bombs In This Game: "&lt;&lt;numOfBombs;


// Process Guesses
do {
    cout&lt;&lt;"\nPlease Input your ROW &amp; COLUMN Guess coordinate (i.e. 3 2): ";
    cin&gt;&gt;rowGuess&gt;&gt;columnGuess;

    if (board [rowGuess] [columnGuess] &gt;= 85) {
        bomb = true;
        cout&lt;&lt;"\n\n\t\tXXXXXX BOMB HIT XXXXXXX\n\t\t\tGame Over.\n\n";
        cout&lt;&lt;"Your Score Score: "&lt;&lt;score;
        cout&lt;&lt;"\n\n Play Again (y/n):";
        cin&gt;&gt;newGame;
        switch (newGame) {
            case 'y':
                cout&lt;&lt;"\n\n";
                playAgain = true;
                break;
            default:
                playAgain = false;
                break;

        }
    } else {
        wasGuessed [rowGuess] [columnGuess] = true;
        score++; 
        reDraw(wasGuessed, 10, 10);
    }
} while (!bomb);

}


return 0;
}

   void reDraw (bool guessed [] [10], int rows, int columns)
{
    // Format row and column headers
    cout&lt;&lt;"  0   1   2   3   4   5   6   7   8  9\n";
    cout&lt;&lt;"0";
for (int i = 0; i &lt; rows; i++) {
    for (int j = 0; j &lt; columns; j++) {

        if ((j+1) % 10 == 0) 
            if ((i+1) == 10) {
                if (guessed [i] [j]) 
                    cout&lt;&lt;"X "&lt;&lt;" \n";
                else 
                    cout&lt;&lt;"? "&lt;&lt;" \n";
            }else{
                if (guessed [i] [j]) 
                    cout&lt;&lt;"X "&lt;&lt;" \n"&lt;&lt;i+1;
                else                
                    cout&lt;&lt;"? "&lt;&lt;" \n"&lt;&lt;i+1;
            }
        if ((j+1) % 10 != 0)
            if (guessed [j] [i]) 
                cout&lt;&lt;" X"&lt;&lt;"  ";
            else
                cout&lt;&lt;" ?"&lt;&lt;"  "; 

    }
}

}
void newBoard (int rows, int columns)
{

cout&lt;&lt;"  0   1   2   3   4   5   6   7   8  9\n";
cout&lt;&lt;"0";
for (int i = 0; i &lt; rows; i++) {
    for (int j = 0; j &lt; columns; j++) {

        if ((j+1) % 10 == 0) 
            if ((i+1) == 10) {
                cout&lt;&lt;"? "&lt;&lt;" \n";
            }else
                cout&lt;&lt;"? "&lt;&lt;" \n"&lt;&lt;i+1;
        if ((j+1) % 10 != 0)
            cout&lt;&lt;" ?"&lt;&lt;"  ";
    }

}


}
</code></pre>

<p>Thanks For Your Help Guys!</p>
