... simulates
 3  // the shuffling and dealing of a deck of playing cards.
 4  #include <iostream>
 5  #include <iomanip>
 6  #include <cstdlib> // prototypes for rand and srand
 7  #include <ctime> // prototype for time
 8  #include "DeckOfCards.h" // DeckOfCards class definition
 9  using namespace std;
10
11  // no-argument DeckOfCards constructor intializes deck
12  DeckOfCards::DeckOfCards() {
13     // initialize suit array
14     static string suit[suits]{"Hearts", "Diamonds", "Clubs", "Spades"};
15
16     // initialize face array
17     static string face[faces]{"Ace", "Deuce", "Three", "Four", "Five",
18        "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
19
20     // set values for deck of 52 Cards
21     for (size_t i{0}; i < deck.size(); ++i) {
22        deck[i].face = face[i ...

Get C++ How to Program, 10/e now with O’Reilly online learning.

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