-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.cpp
More file actions
95 lines (77 loc) · 1.93 KB
/
Card.cpp
File metadata and controls
95 lines (77 loc) · 1.93 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <iostream>
#include "Card.h"
//Defining Constructor
Card::Card(Suits suits, Values values) {
_suits = suits;
_values = values;
}
//Function to string the cards to make them string
std::string Card::suitToString() const {
switch (_suits) {
case Suits::CLUBS:
return "Clubs";
case Suits::HEARTS:
return "Hearts";
case Suits::SPADES:
return "Spades";
case Suits::DIAMOND:
return "Diamond";
case Suits::endSuits:
return "Unknown";
}
return "undefined";
}
//We string the values of the card
std::string Card::valueToString() const {
switch (_values) {
case Values::TWO:
return "2";
case Values::THREE:
return "3";
case Values::FOUR:
return "4";
case Values::FIVE:
return "5";
case Values::SIX:
return "6";
case Values::SEVEN:
return "7";
case Values::EIGHT:
return "8";
case Values::NINE:
return "9";
case Values::TEN:
return "10";
case Values::JACK:
return "Jack";
case Values::QUEEN:
return "Queen";
case Values::KING:
return "King";
case Values::ACE:
return "Ace";
case Values::endValues:
return "undefined";
}
return "ERROR ";
}
//We print out the 2 functions of the toString
void Card::ToString() const {
std::cout << Card::valueToString() << " Of " << Card::suitToString();
std::cout << "\n";
}
//We compare the values and return it as a boolean for another function
bool Card::compareCardValues(Card A, Card B) {
if (A._values < B._values) {
return true;
} else {
return false;
}
}
//Simple get Functions
Values Card::getValue() {
return _values;
}
Suits Card::getSuits() {
return _suits;
}