-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcard.cpp
70 lines (64 loc) · 2.21 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
#include "card.hpp"
/******************************************************************
* Function: Card()
* Description: Default Card constructor that sets both private
variables to 0
* Parameters: None
* Pre-Conditions: None
* Post-Conditions: The private variables are initialized
******************************************************************/
Card::Card(){
rank = 0;
suit = 0;
}
/******************************************************************
* Function: getRank() const
* Description: gets this Card's rank
* Parameters: None
* Pre-Conditions: rank has been initialized
* Post-Conditions: rank's value is accessible
******************************************************************/
int Card::getRank() const{
return rank;
}
/******************************************************************
* Function: getSuit() const
* Description: gets this Card's suit
* Parameters: None
* Pre-Conditions: suit has been initialized
* Post-Conditions: suit's value is accessible
******************************************************************/
int Card::getSuit() const{
return suit;
}
/******************************************************************
* Function: setRank(int r)
* Description: sets this Card's rank
* Parameters: int r
* Pre-Conditions: None
* Post-Conditions: rank is re-assigned to r's value
******************************************************************/
void Card::setRank(int r){
rank = r;
}
/******************************************************************
* Function: setSuit(int s)
* Description: sets this Card's suit
* Parameters: int s
* Pre-Conditions: None
* Post-Conditions: suit is re-assigned to s' value
******************************************************************/
void Card::setSuit(int s){
suit = s;
}
/******************************************************************
* Function: printCard()
* Description: prints this Card's rank and suit
* Parameters: None
* Pre-Conditions: None
* Post-Conditions: None
******************************************************************/
void Card::printCard(){
cout << "Rank: " << rank << endl;
cout << "Suit: " << suit << endl;
}