资源描述:
《c++扑克牌游戏---抽王八_代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、….H头文件,.cpp执行文件//Card.hclassPlayer;voidgotoxy(intx,inty);classCard{private:intamount;charcolor;//3red4square5plum6blackCard*pcard;public:Card():amount(14),color(3){}voidset(int,char);voidshow(intx=0,inty=0);//横着输//voidprint(int=0,inty=0);//背面show正面print背面stand竖的line封底//voidsh
2、owstand(intx=0,inty=0);//竖着输出//voidprintstand(intx=0,inty=0);//背面//voidshowstandline(intx=0,inty=0);//voidprintstandline(intx=0,inty=0);//voidprintline(intx=0,inty=0);voidshowline(intx=0,inty=0);//作为封底用的voidsetpcard(Card*);voidexact(intno);//精确输出JQKACard*backpcard();intbackam
3、ount();friendvoidGiveout(Player*,int);friendvoidshowplayer(Player*player,intn);};//Player.hclassCard;classPlayer{private:intnumber;intFlag;Card*phead;public:Player():number(0),phead(0){}Card*&backph();//外部接口int&backflag();int&backno();voidshowcard(int,int);//需要player的位置坐标void
4、setpp(Card*);friendvoidchange(Player&player);friendvoidGiveout(Player*,int);friendvoidshowplayer(Player*player,intn);};//Game.h#include"Card.h"#include"Player.h"voidcancel(Card*pc,Card*&ph);voidcanceldouble(Player*player,intn);voidGiveout(Player*player,inta);voidshowplayer(Pl
5、ayer*player,intn);voidvircancel(Card*pc,Player&player);voidcomparecard(Player&player,Card*pc);Card*find(Card*ph,intn);voidindex(Card*&ph,Card*pc,intn);intplaygame(Player*player,intn);voidintroduction();voidend();//Card的实现#include#include"Card.h"#includeusi
6、ngnamespacestd;//enumColor{red,black,square,plum};//gotoxy()函数#include//??????????voidgotoxy(inty,intx)//vc下没有,要自定义!{COORDTo={x,y};SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),To);}voidCard::exact(intno){if(no<11)cout<7、';break;case12:cout<<'Q';break;case13:cout<<'K';break;case14:cout<<'A';break;case15:cout<<"王";break;}}}voidCard::show(intx,inty)//可以定位的{inti=0;gotoxy(x,y);//使用gotoxy语句代替回车换行,可以具体定位!!!cout<<"/"<<"--------";gotoxy(x+1,y);cout<<"
8、";exact(amount);gotoxy(x+2,y);cout<<"
9、"<10、r(i=0;i<3;i++){gotoxy(x+3+i,y);cout<<"
11、";}gotoxy(x+3+i,y);cout<<'\'