实现随机发牌的应用(C++)

介绍

通过随机产生的牌,分别分发给4个人,并将结果保存至puke.txt文件中。
 



-完整源码
 

//扑克随机洗牌结果到保存文件 
#include 
#include 
#include 
#include 
#include 
#define SUIT_NUMBER 4
#define FACE_NUMBER 13
using namespace std;

class Card //扑克类 
{
public:
	string suit; //花色
	string face; //面值
};

class CardManager
{
private:
	Card deck[SUIT_NUMBER][FACE_NUMBER]; //4*13=52张扑克牌
public:
	CardManager() { //构造函数
		string suit[] = {"红桃","花块","梅花","黑桃"};
		string face[]=
		{"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
		for(int i=0;i

 

你可能感兴趣的:(#,C语言/C++,类应用)