title: Can't end while loop (C++)
body: <p>I can't seem to end this while loop and I have tried every single way I know but it's still not working. The variable "contGame" just kept changing to "true" even if I have already changed it to "false". Can you guys help me! Note that this inside a class. Here is my code:</p>
  
  <pre><code>while (contGame == true)
      {
          if (turn == 1)
          {
              cout &lt;&lt; Board._player1Name &lt;&lt;"'s turn!!\n";
              X = getMoveX();
              Y = getMoveY();
  
              Board.Board[X][Y] = player1Sign;
              Board.printBoard();
              turn = turn + 1;
              Board.checkGame(contGame, player1Sign, player2Sign);
              if (checkGame(contGame, player1Sign, player2Sign) == false)
              {
                  bool contGame = false;
                  cout &lt;&lt; contGame &lt;&lt; endl;
              }
          } 
          cout &lt;&lt; contGame &lt;&lt; endl;
          if(turn == 2)
          {
              cout &lt;&lt; Board._player2Name &lt;&lt;"'s turn!!\n";
              X = getMoveX();
              Y = getMoveY();
  
              Board.Board[X][Y] = player2Sign;
              Board.printBoard();
              turn = turn - 1;
              Board.checkGame(contGame, player1Sign, player2Sign);
              if (checkGame(contGame, player1Sign, player2Sign) == false)
              {
                  int contGame = 1;
                  cout &lt;&lt; contGame &lt;&lt; endl;
              }
          }
      }  
  </code></pre>
  
  <p>And this is checkGame:</p>
  
  <pre><code>bool contGameA = true;
  for (int k = 0; k &lt; 3; k++)
      {
  
          if (Board[k][0] == Board[k][1] &amp;&amp; Board[k][1] == Board[k][2] &amp;&amp; Board[k][2] == player1Sign)
          {
              cout &lt;&lt; "\\\\" &lt;&lt; _player1Name &lt;&lt;" wins!////\n";
              contGameA = false;
          }
          else if (Board[k][0] == Board[k][1] &amp;&amp; Board[k][1] == Board[k][2] &amp;&amp; Board[k][2] == player2Sign)
          {
              cout &lt;&lt; "\\\\" &lt;&lt; _player2Name &lt;&lt; " wins!////\n";
              contGameA = false;
          }
      }
  
  for (int r = 0; r &lt; 3; r++)
      {
          if (Board[0][r] == Board[1][r] &amp;&amp; Board[1][r] == Board[2][r] &amp;&amp; Board[2][r] == player1Sign)
          {
              cout &lt;&lt; "\\\\" &lt;&lt; _player1Name &lt;&lt; " wins!////\n";
              contGameA = false;
          }
          else if (Board[0][r] == Board[1][r] &amp;&amp; Board[1][r] == Board[2][r] &amp;&amp; Board[2][r] == player2Sign)
          {
              cout &lt;&lt; "\\\\" &lt;&lt; _player2Name &lt;&lt; " wins!////\n";
              contGameA = false;
          }   
      }
  
  if (Board[0][0] == Board[1][1] &amp;&amp; Board[1][1] == Board[2][2] &amp;&amp; Board[2][2] == player1Sign)
      {
          cout &lt;&lt; "\\\\" &lt;&lt; _player1Name &lt;&lt; " wins!////\n";
          contGameA = false;
      } else if (Board[0][0] == Board[1][1] &amp;&amp; Board[1][1] == Board[2][2] &amp;&amp; Board[2][2] == player2Sign)
      {
          cout &lt;&lt; "\\\\" &lt;&lt; _player2Name &lt;&lt; " wins!////\n";
          contGameA = false;
      }
  
  if (Board[0][2] == Board[1][1] &amp;&amp; Board[1][1] == Board[2][0] &amp;&amp; Board[2][0] == player1Sign)
      {
          cout &lt;&lt; "\\\\" &lt;&lt; _player1Name &lt;&lt; " wins!////\n";
          contGameA = false;
      } else if (Board[0][2] == Board[1][1] &amp;&amp; Board[1][1] == Board[2][0] &amp;&amp; Board[2][0] == player2Sign)
      {
          cout &lt;&lt; "\\\\" &lt;&lt; _player2Name &lt;&lt; " wins!////\n";
          contGameA = false;
      }
  return contGameA;
  </code></pre>