title: "Condition is always true" when I know it's not
body: <p>I made a blackjack game for my C++ course. I have a problem checking who won the game. During the game I check after each draw whether or not that person busted (exceeded 21 in total). If they did bust I store it in a variable. They are <code>playerBust</code> and <code>dealerBust</code>. They are initialized to <code>0</code>.</p>
  
  <p>The win-check is a standard if/else-if segment. It says that <code>playerBust == 1</code> is always false, and that <code>dealerBust == 0</code> is always true.</p>
  
  <p>However, the last test of the game I logged both of these, and <code>dealerBust = 1</code> by the end. </p>
  
  <p>A few explanations of my code:</p>
  
  <p><code>deck.newdeck</code> gives me a new, shuffled deck.</p>
  
  <p><code>initializeGame();</code> sets the player's and dealer's hand total to <code>0</code>.</p>
  
  <p><code>.toString()</code> simply return a string naming a card, for instance "Ace of Spades".</p>
  
  <p><code>getPlayerCardValue(...)</code>and <code>getDealerCardValue(...)</code> just evaluates the numerical value of the card just drawn.</p>
  
  <pre><code>void Blackjack::playGame(){
  deck.newDeck();
  initializeGame();
  drawInitialCards();
  bool playerBust = 0;
  bool dealerBust = 0;
  Card newCard;
  
  // PLAYERS TURN
  if (playerHand &gt; 21){
      playerBust = 1;
  }
  else if (playerHand &lt; 21){
      bool stopDraw = 0;
      while (stopDraw == 0){
          bool playerDraw = askPlayerDrawCard();
          if (playerDraw == 1){
              newCard = deck.drawCard();
              cout &lt;&lt; endl &lt;&lt; "You drew: " &lt;&lt; newCard.toString() &lt;&lt; endl;
              playerHand += getPlayerCardValue(newCard);
              cout &lt;&lt; "Player's total: " &lt;&lt; playerHand &lt;&lt; endl;
              if (playerHand &gt; 21){
                  playerBust = 1;
                  stopDraw = 1;
              }
          }
          else if (playerDraw == 0){
              stopDraw = 1;
          }
      }
  }
  
  // DEALERS TURN
  dealerHand += getDealerCardValue(dealerFaceDown, dealerHand);
  cout &lt;&lt; "Dealer's face down card is: " &lt;&lt; dealerFaceDown.toString() &lt;&lt; endl
  &lt;&lt; "Dealer's total: " &lt;&lt; dealerHand &lt;&lt; endl;
  
  if (dealerHand &gt; 21){
      dealerBust = 1;
  }
  else if (dealerHand &lt; 21){
      while (dealerHand &lt; 17){
          newCard = deck.drawCard();
          cout &lt;&lt; endl &lt;&lt; newCard.toString() &lt;&lt; endl;
          dealerHand += getDealerCardValue(newCard, dealerHand);
          cout &lt;&lt; "Dealer's hand totals: " &lt;&lt; dealerHand &lt;&lt; endl;
          if (dealerHand &gt; 21){
              dealerBust = 1;
          }
      }
  }
  
  // WINNING CONDITIONS
  if (playerBust == 1 || dealerBust == 1){
      cout &lt;&lt; "Tie" &lt;&lt; endl;
  }
  else if (playerBust == 1 || dealerBust == 0){
      cout &lt;&lt; "Dealer wins" &lt;&lt; endl;
  }
  else if (playerBust == 0 || dealerBust == 1){
      cout &lt;&lt; "Player wins" &lt;&lt; endl;
  }
  else if (playerBust == 0 || dealerBust == 0){
      if (playerHand &gt; dealerHand){
          cout &lt;&lt; "Player wins" &lt;&lt; endl;
      }
  }
  cout &lt;&lt; endl &lt;&lt; "Player's bust: " &lt;&lt; playerBust &lt;&lt; endl &lt;&lt; "Dealer's bust: " &lt;&lt; dealerBust &lt;&lt; endl;
  </code></pre>