20.4. Example: Card Shuffling and Dealing Simulation

The card shuffling and dealing program in Figs. 20.220.4 represents the deck of cards as an array of structures.

 1   // Fig. 20.2: DeckOfCards.h 2   // Definition of class DeckOfCards that 3   // represents a deck of playing cards. 4   #include <string> 5   #include <array> 6  7   // Card structure definition  8   struct Card                  9   {                           10      std::string face;        11      std::string suit;        12   }; // end structure Card    13 14   // DeckOfCards class definition15   class DeckOfCards16   {17   public:18      static const int numberOfCards = 52;19      static const int faces = 13;20      static const int suits ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.