1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include <string>
#include <vector>
#include <iostream>
using namespace std;
enum Face { three = 3, four, five, six, seven, eight, nine, ten, jack, queen, king, joker };
enum Suit { diamonds, spades, hearts, stars, clubs, none };
class Card {
friend bool operator<(const Card &first, const Card &second);
friend bool operator==(const Card &first, const Card &second);
friend ostream &operator<<(ostream &out, const Card &c);
public:
Card(Face face, Suit suit); //constructor
int getValue();
Face getFace();
Suit getSuit();
string toString();
string CardAsString; // storing the face and suit as a string
string face() const { return CardAsString; } //returning the face and suit as a string in the overload<< so it can be shuffled
private:
Face faceValue;
Suit suitValue;
};
class CardDeck {
private:
std::vector<Card> deckOfCards; //store the all the cards into a vector
public:
CardDeck();
Card deal();
int numCards();
int addCard(Card newCard);
string toString();
void shuffle();
};
class Hand {
vector<Card> cardHand;
public:
Hand();
int addCard(Card newCard);
int getValue();
int numCards();
string toString();
};
|