-
Notifications
You must be signed in to change notification settings - Fork 1
/
DeckOfCards.h
58 lines (52 loc) · 1.13 KB
/
DeckOfCards.h
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
53
54
55
56
57
58
#ifndef DECKOFCARDS_H
#define DECKOFCARDS_H
#include <iostream>
#include <sstream>
#include <queue>
using namespace std;
struct Card {
int weight;
string name;
string suit;
Card *next;
Card *previous;
Card() {
next = NULL;
previous = NULL;
}
Card (int num, string n, string s) {
next = NULL;
previous = NULL;
weight = num;
name = n;
suit = s;
}
Card (int num, int n, string s) {
stringstream ss;
ss << n;
next = NULL;
previous = NULL;
weight = num;
name = ss.str();
suit = s;
}
};
class DeckOfCards {
public:
DeckOfCards();
~DeckOfCards();
void printDeck();
void rebuildDeck();
void perfectShuffle();
Card* pickRandomCard();
Card* pickCardFromPosition(int pos);
Card* getCard(string name, string suit);
queue<Card*> dealCards(int i);
private:
int deckSize = 52;
void buildDeck();
void shiftDeck();
void shiftDeckFromPosition(int i);
Card* deck[52];
};
#endif // DECKOFCARDS_H