#ifndef _DECK_H #define _DECK_H //**************************************************************************** // File: Deck.h // Author: Dr. Thomas C. Bressoud // Date: February 8, 2008 // Class: CS 173-01, Professor Bressoud // Purpose: Interface file for the Deck class, defining a collection of 52 // Card objects in a static array, and with operations to shuffle // the deck and to deal cards from the deck. // Input: NA // Output: NA //**************************************************************************** #include "Card.h" class Deck { public: //-------------------------------------------------------------------------- // Static constants available without an object instance // static const int COUNT = 52; // Number of cards in a deck //-------------------------------------------------------------------------- // Constructor(s) // Deck(); // Create a deck of 52 cards in sorted order //-------------------------------------------------------------------------- // Mutator functions // void shuffle(); // Shuffle the cards without changing seed void shuffle(bool randomize); // Shuffle the deck and randomize seed Card dealCard(); // Deal card from the current dealIndex //-------------------------------------------------------------------------- // Accessor functions // int cardsRemaining() const; // Return the number of undealt cards left private: //-------------------------------------------------------------------------- // Domain includes collection of cards and place within deck that determines // next card to deal. // Card cards[COUNT]; // Array of cards forming the deck int dealIndex; // Current "deal point" in the deck //-------------------------------------------------------------------------- // Private utility function used within class // void cardSwap(Card & c1, // Private function to swap two cards by ref Card & c2); }; // class Deck #endif