-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.cpp
88 lines (81 loc) · 1.55 KB
/
Card.cpp
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
#include "Card.h"
#include <string>
#include <iostream>
using namespace std;
Card::Card() {}
Card::Card(char r,char s){
Rank = r;
Suit = s;
}
void Card::display() {
string symbol;
switch (Suit) {
case 'S':
symbol = "\u2660";//Spades
break;
case 'H':
symbol = "\u2661"; //Heart
break;
case 'D':
symbol = "\u25C7"; //Diamond
break;
case 'C':
symbol = "\u2618"; //Clubs
break;
}
if (Rank == 't'){
cout << "10" << symbol << "\t";
}else {
cout << Rank << symbol << "\t";
}
}
int Card::getValue()
{
int Val;
switch (Rank) {
case 'A':
Val = 1; //Ace
break;
case '2':
Val = 2;
break;
case '3':
Val = 3;
break;
case '4':
Val = 4;
break;
case '5':
Val = 5;
break;
case '6':
Val = 6;
break;
case '7':
Val = 7;
break;
case '8':
Val = 8;
break;
case '9':
Val = 9;
break;
case 't':
Val = 10;
break;
case 'J':
Val = 10; //Jack
break;
case 'Q':
Val = 10; //Queen
break;
case 'K':
Val = 10; //King
break;
}
return Val;
}
void Card::setCard(char r, char s) {
Rank = r;
Suit = s;
}