-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.cpp
94 lines (88 loc) · 1.03 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
89
90
91
92
93
94
#include <iostream>
#include <cstdlib>
#include "card.h"
using namespace std;
int thisCard(char c)
{
return (c%13);
}
void printName(char c)
{
char temp = (c%13);
switch(temp)
{
case ACE:
cout << "A";
break;
case TWO:
cout << "2";
break;
case THREE:
cout << "3";
break;
case FOUR:
cout << "4";
break;
case FIVE:
cout << "5";
break;
case SIX:
cout << "6";
break;
case SEVEN:
cout << "7";
break;
case EIGHT:
cout << "8";
break;
case NINE:
cout << "9";
break;
case TEN:
cout << "T";
break;
case JACK:
cout << "J";
break;
case QUEEN:
cout << "Q";
break;
case KING:
cout << "K";
break;
default:
exit(20);
}
}
int pointValue(char c)
{
char temp = (c%13);
switch(temp)
{
case ACE:
return 11;
case TWO:
return 2;
case THREE:
return 3;
case FOUR:
return 4;
case FIVE:
return 5;
case SIX:
return 6;
case SEVEN:
return 7;
case EIGHT:
return 8;
case NINE:
return 9;
case TEN:
case JACK:
case QUEEN:
case KING:
return 10;
default:
exit(21);
}
}