21点游戏代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
21点游戏代码.txt举得起放得下叫举重,举得起放不下叫负重。头要有勇气,抬头要有底气。学习要加,骄傲要减,机会要乘,懒惰要除。人生三难题:思,相思,单相思。
#include
#include
#include
#include
#include"string.h"
#include
using namespace std;
///////////////////////
////////////////////////////////////
class Card
{
private:
char m_type;
int m_num;
public:
void card(char a,int b){m_type=a,m_num=b;}
int outnum(){return m_num;}
int GetText();
};
class Poker
{
private:
int count;
Card card[54];
public:
Poker();
void Xipai();
int Fapai();
int sum(int,int,int);
Card *getcard();
};
///////////////////////////////////////////////////
Card *h;
int get(int max,int min);
// TODO: reference additional headers your program requires here
///////////////////////////////////////////
class Player
{
public:
Card *card[20];
int count;
char name[10];
int score;
Player(){
count=score=0;
for(int i=0;i<20;i++)
card[i]=NULL;
}
int showpoint();
void showpoker();
void reset();
};
class Newgame
{
private:
Poker *poker;
Player *player[5];
int num,n;
char boss[10],a[10];
public:
Newgame();
void login();
void begin();
char *victory();
bool callpoker(Player &);
void show();
};
////////////////////////
void Newgame::show()
{
for(int f=0;f<54;f++)
poker->Fapai();
}
/////////////////////////////////
int get(int max,int min)
{
int n=rand();
n=n%(max-min+1)+min;
return n;
}
int Card::GetText()
{
if((1==m_num)&&(m_type=='K')){ printf("′èæ? ");return 1;}
if((0==m_num)&&(m_type=='K')){ printf("D?æ? ");return 1;} int k=m_num%13;
switch(k)
{
case 1:{if(m_type=='H') cout<<"oååçA ";
if(m_type=='C') cout<<"???¨A ";
if(m_type=='D') cout<<"???ãA ";
if(m_type=='S') cout<<"oëåçA ";
return 1;}
case 11:{
if(m_type=='H'){ cout<<"oååçJ "; return 1;}
if(m_type=='C'){ cout<<"???¨J "; return 1;}
if(m_type=='D'){ cout<<"???ãJ "; return 1;}
if(m_type=='S'){ cout<<"oëåçJ "; return 1;}
}
case 12:
{
if(m_type=='H'){ cout<<"oååçQ "; return 1;}
if(m_type=='C'){ cout<<"???¨Q "; return 1;}
if(m_type=='D'){ cout<<"???ãQ "; return 1;}
if(m_type=='S'){ cout<<"oëåçQ "; return 1;}
}
case 0:{if(m_type='H'){ cout<<"oååçK "; return 1;}
if(m_type=='C'){ cout<<"???¨K "; return 1;}
if(m_type=='D'){ cout<<"???ãK "; return 1;}
if(m_type=='S'){ cout<<"oëåçK "; return 1;}
}
return 1;
}
if(m_num<=10&&m_num>=2)
{
if(m_type=='H'){ cout<<"oååç"< if(m_type=='C'){ cout<<"???¨"< if(m_type=='D'){ cout<<"???ã"< if(m_type=='S'){ cout<<"oëåç"< return 1; } Poker::Poker(){ count=54; for(int i=0;i<13;i++) card[i].card('H',(i+1)); for(i=13;i<26;i++) card[i].card('C',((i%13)+1));