Output
Variable Name     Value in Memory
n
deck[0]
0
deck[1]
0
deck[2]
0
deck[3]
.
.
.
.
deck[51]
0
0
0
0
0
0.0
0.0
0.0
sum
average
count
  1  #include <iostream>
  2  #include <ctime>
  3  #include <cstdlib>
  4  #include <string>
  5  using namespace std;
  6  
  7  int main()
  8  {
  9    const int NUMBER_OF_CARDS = 52;
 10    int deck[NUMBER_OF_CARDS];
 11    string suits[] = {"Spades", "Hearts", "Diamonds", "Clubs"};
 12    string ranks[] = {"Ace", "2", "3", "4", "5", "6", "7", "8", 
 13      "9", "10", "Jack", "Queen", "King"};
 14  
 15    // Initialize cards
 16    for (int i = 0; i < NUMBER_OF_CARDS; i++)
 17      deck[i] = i;
 18  
 19    // Shuffle the cards
 20    srand(time(0));
 21    for (int i = 0; i < NUMBER_OF_CARDS; i++)
 22    {
 23      // Generate an index randomly
 24      int index = rand() % NUMBER_OF_CARDS;
 25      int temp = deck[i];
 26      deck[i] = deck[index];
 27      deck[index] = temp;
 28    }
 29  
 30    // Display the first four cards
 31    for (int i = 0; i < 4; i++)
 32    {
 33      string suit = suits[deck[i] / 13];
 34      string rank = ranks[deck[i] % 13];
 35      cout << "Card number " << deck[i] << ": " 
 36        << rank << " of " << suit << endl;
 37    }
 38  
 39    return 0;
 40  }