-
Notifications
You must be signed in to change notification settings - Fork 45
/
cards.hpp
52 lines (42 loc) · 1.03 KB
/
cards.hpp
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
47
48
49
50
51
52
/*
** CARDS.HPP - Declare card classes
**
** public domain by Bob Stout
*/
#ifndef CARDS__HPP
#define CARDS__HPP
const int Card_Error = -1;
const int Deck_Size = 52;
typedef enum {Rank_Error = Card_Error, Ace = 1, Deuce, Trey, Spot_4, Spot_5,
Spot_6, Spot_7, Spot_8, Spot_9, Spot_10, Jack = 11, Queen = 12,
King = 13} cardRank;
typedef enum {Suit_Error = Card_Error, Diamond, Club, Heart, Spade} cardSuit;
class card
{
private:
cardRank rank_;
cardSuit suit_;
public:
card(void);
card(cardSuit s, cardRank r);
cardRank rank(void);
cardSuit suit(void);
void get_card(cardSuit &s, cardRank &r);
char *rankText(void);
char *suitText(void);
void set_rank(cardRank r);
void set_suit(cardSuit s);
void set_card(cardSuit s, cardRank r);
};
class deck
{
private:
class card card_[Deck_Size];
unsigned top;
public:
deck(void);
void shuffle(void);
void deal(class card &c);
int cards_left(void);
};
#endif // CARDS__HPP