-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.cpp
More file actions
executable file
·65 lines (56 loc) · 1.08 KB
/
Card.cpp
File metadata and controls
executable file
·65 lines (56 loc) · 1.08 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
// Card.cpp: implementation of the Card class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Scoundrel.h"
#include "Card.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Card::Card(int rank, CardSuit suit)
: rank(rank), suit(suit)
{
}
Card::Card(const Card &other)
: rank(other.rank), suit(other.suit)
{
}
Card &Card::operator=(const Card &other)
{
if (this != &other)
{
rank = other.rank;
suit = other.suit;
}
return *this;
}
Card::~Card()
{
}
int Card::Value()
{
if (rank == 1)
{
return 14;
}
return rank;
}
CString Card::Label() const
{
if (rank == 1)
return _T("A");
if (rank == 11)
return _T("J");
if (rank == 12)
return _T("Q");
if (rank == 13)
return _T("K");
CString str;
str.Format(_T("%d"), rank);
return str;
}