
Untitled
By: a guest on
Jul 15th, 2012 | syntax:
None | size: 1.71 KB | hits: 9 | expires: Never
#ifndef CARDDECK_H_INCLUDED
#define CARDDECK_H_INCLUDED
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include "PlayingCard.h"
const int SIZE_OF_DECK = 52;
class PlayingCardDeck
{
PlayingCard* deck[SIZE_OF_DECK];
public:
//Default Constructor - Creates an unshuffled deck of 52 playing cards. These playing cards are to be implemented as pointers to PlayingCards.
PlayingCardDeck();
//Overloaded Constructor - shuffles the deck numShuffles times
PlayingCardDeck(int numShuffles);
//Destructor - When a deck is deleted, the cards remaining in the deck must be deleted.
~PlayingCardDeck()
{
deleteDeck();
std::cout << "Deck destroyed.";
}
//Returns a pointer to a PlayingCard object taken from "the top" of the deck.
//If there are no more cards in the deck, it returns a null pointer (i.e. 0) and displays a warning.
PlayingCard* dealCard();
//For deck shuffling. Cannot shuffle if any cards are missing.
bool shuffle(int numShuffles);
//Resets the deck to a full deck of 52 unshuffled cards.
//Remember that when you do this, you must manage the dynamically allocated cards in the deck.
void reset();
//Returns a string containing all the value and suit codes for the deck.
//If there have been cards dealt from the deck, those cards will not be displayed.
std::string getAllCardCodes();
//Returns the number of cards already dealt from the deck.
int getCountUsed();
//Returns the number of cards remaining in the deck.
int getCountRemain();
private:
//Creates an unshuffled deck of 52 unique cards
void createDeck();
void deleteDeck();
};
#endif // CARDDECK_H_INCLUDED