title: Trying to Shuffle a Deck of Cards and Mark them
body: <p>Im trying to make my code shuffle an initialized stack of cards (brand new pack of cards). I am able to actually shuffle the cards and store them in a new array. However, I am unsure how to mark the shuffled deck as cardInDeck = true.</p>
  <pre><code>struct CARD
  {
      char cardSuit {};
      char cardFace {};
      int cardValue {};
      bool cardInDeck {};
      
      void printCard(){
          std::cout &lt;&lt; cardFace &lt;&lt; cardSuit &lt;&lt; &quot;\n&quot;;
      }
  };
  </code></pre>
  <pre><code>int main()
  {
      const int numberOfCards {52};
      const int cardRank {13};
      const int numberOfSuits {4};
      
      CARD stackOfCards[numberOfCards];
      
      char cardSuit [] = {'H','S','C','D'};
      
      char cardFace [] = {'A', '2','3','4','5','6','7','8','9','T','J','Q','K'};
      
      int cardValue [] = {11,2,3,4,5,6,7,8,9,10,10,10,10};
     
      int k = 0;
      for(int suit = 0; suit &lt; numberOfSuits; suit++)
      {
          for(int rank = 0; rank &lt; cardRank; rank++)
          {
              //CARD temp;
              stackOfCards[k].cardSuit = cardSuit[suit];
              stackOfCards[k].cardFace = cardFace[rank];
              stackOfCards[k].cardValue = cardValue[rank];
              k++;
              
              int index = (13 * numberOfSuits) + cardRank - 1;
              stackOfCards[index].cardInDeck = false;
              
              //temp.cardInDeck = true;
          }
      } // end of card stack initializer
      
      srand(time(0));
      CARD shuffledDeck [numberOfCards];
      
      // Using a for loop to randomize the stack of cards and then inserting each card into a new array for shuffled cards
      for (int cardCounter = 0; cardCounter &lt; numberOfCards; cardCounter++)
      {
          int randomNum =  rand() % 52;
          CARD temp = stackOfCards[cardCounter];
          shuffledDeck[cardCounter] = stackOfCards[randomNum];
          shuffledDeck[randomNum] = temp;
          
          //If statement checking the status of cardInDeck
          //If labeled as false (they all should be right now) they are then changed to true
          if (temp.cardInDeck == false)
          {
              stackOfCards[cardCounter].cardInDeck = true;
              stackOfCards[randomNum].cardInDeck = shuffledDeck[cardCounter].cardInDeck;
          }
          /*
          else
          {
              shuffledDeck[randomNum].cardInDeck = stackOfCards[cardCounter].cardInDeck;
              cardCounter ++;
          }
           */
      }
  </code></pre>
  <p>I've been trying to figure this out for a while and the most I've been able to do is marking all the cards in the stack as in the deck (cardInDeck = true), but I am unable to copy it into the deck at the current shuffled card number.</p>
  <p>The goal is to check the in-deck status of the randomNum index in the stackOfCards array. If this card is marked as not in the deck (they all should be marked false) I need to mark it as in the deck. Then I need to copy it into the shuffledDeck at the current shuffled card number. When debugging I noticed that some cards (16) are marked as true while the rest are marked as false.</p>