Blackjack
|
Defines CardRank
.
More...
#include <cstddef>
#include <iostream>
Go to the source code of this file.
Enumerations | |
enum class | CardRank { rank_2 , rank_3 , rank_4 , rank_5 , rank_6 , rank_7 , rank_8 , rank_9 , rank_10 , rank_jack , rank_queen , rank_king , rank_ace , max_ranks } |
The rank of a card. More... | |
Functions | |
char | getName (const CardRank rank) |
Get a character representation of a card's rank. | |
CardRank | getRank (std::size_t rank) |
Given an integer, get the corresponding rank enum. | |
int | getValue (const CardRank rank) |
Get the numeric value of a card's rank. | |
std::size_t | getNumRanks () |
An auxiliary function that defines an upper bound on the number of ranks a deck of cards can have. | |
std::ostream & | operator<< (std::ostream &out, const CardRank &rank) |
Overloads << to print the rank of a card. | |
Defines CardRank
.
|
strong |
char getName | ( | const CardRank | rank | ) |
Get a character representation of a card's rank.
rank |
rank_5
has the character representation: '5'.rank_10:
'T'rank_jack:
'J'rank_king:
'K'rank_queen:
'Q'rank_ace:
'A'CardRank getRank | ( | std::size_t | rank | ) |
Given an integer, get the corresponding rank enum.
rank |
Type-cast rank
to CardRank
int getValue | ( | const CardRank | rank | ) |
Get the numeric value of a card's rank.
rank |
std::size_t getNumRanks | ( | ) |
An auxiliary function that defines an upper bound on the number of ranks a deck of cards can have.
max_ranks
max_ranks
is of type CardRank
; You've to typecast it to std::size_t
. std::ostream & operator<< | ( | std::ostream & | out, |
const CardRank & | rank | ||
) |
Overloads <<
to print the rank of a card.
out | |
obj |