... 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.