#ifndef POKER_H_
#define POKER_H_
//suits: Games Any of the four sets of 13 playing cards
//(clubs, diamonds, hearts, and spades) in a standard deck,
//the members of which bear the same marks.
//红桃 : H - Heart 桃心(象形), 代表爱情
//黑桃 : S - Spade 橄榄叶(象形), 代表和平
//方块 : D - Diamond 钻石(形同意合), 代表财富
//梅花 : C - Club 三叶草(象形), 代表幸运
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
#include <cctype>
using namespace std;
struct Card
{
string mark;
string point;
};
class Poker
{
public:
const string Mark[4] = { "红桃", "黑桃", "方块", "梅花" };
const string Point[13] = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
private:
Card card[52];
static int num;
public:
Poker();
void randomPoker();
Card& dealPoker();
};
#endif
#include "poker.h"
int Poker::num = 0;
Poker::Poker()
{
for (int i = 0; i < 52; i++)
{
card[i].mark = Mark[i % 4];
card[i].point = Point[i % 13];
}
}
void Poker::randomPoker()
{
srand((unsigned int)time(0));
for (int i = 0; i < 52; i++)
{
Card temp;
temp = card[i];
int r = rand() % 52;
card[i] = card[r];
card[r] = temp;
}
}
Card& Poker::dealPoker()
{
if (num < 52)
return card[num++];
else
cout << "No more cards!\n";
exit(EXIT_FAILURE);
}
#include "poker.h"
void showBl