-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.h
48 lines (36 loc) · 1.13 KB
/
Card.h
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
//Card interface file
#ifndef __CARD_H__
#define __CARD_H__
#include <iostream>
using namespace std;
class Card {
private:
char suit;
int rank;
public:
/* Assigns a default value of 2 of Clubs
*/
Card();
/* Assigns the Card the suit and rank provided.
suits: c = Clubs, d = Diamonds, h = Hearts, s = Spades
If an invalid suit is provided, sets the suit to Clubs
ranks: 1 - 13 (1 = Ace, 11 = Jack, 12 = Queen, 13 = King)
If an invalid rank is provided, sets the rank to 2
Accepts lower or upper case characters for suit
*/
Card(char, int);
/* Returns the Card's suit
*/
char getSuit() const;
/* Returns the Card's rank as an integer
*/
int getRank() const;
/* Outputs a Card in the following format: Rank of Suit
For example, if the rank is 3 and the suit is h: 3 of Hearts
Or, if the rank is 1 and the suit is d: Ace of Diamonds
Or, if the rank is 12 and the suit is c: Queen of Clubs
etc.
*/
friend ostream & operator<<(ostream &, const Card &);
};
#endif