狠狠综合久久av,国产白丝在线观看,精品一区二区国语对白,欧洲在线视频

聯(lián)系我們 - 廣告服務(wù) - 聯(lián)系電話:
您的當(dāng)前位置: > 關(guān)注 > > 正文

世界實(shí)時(shí):C++撲克牌類的設(shè)計(jì) C++撲克牌類怎么設(shè)計(jì)?

來源:CSDN 時(shí)間:2022-12-21 19:03:50


(資料圖片僅供參考)

C++撲克牌

1、設(shè)計(jì)撲克類Card:主要屬性有花色和點(diǎn)數(shù);主要方法有初始化、輸出、比較大小等 2、設(shè)計(jì)一副撲克牌類Cards:主要屬性包括撲克對象數(shù)組;主要方法有初始化、洗牌、輸出等。 3、編寫測試程序。

#include#include#include#include#include#includeusing namespace std;class Card{public:string color;string point;Card(string color, string point);Card(string point);void display();void battle(Card card1);};class Cards{public:        vectorcard;        Cards();void display_all();        void shufflePoker();};Card::Card(string color, string point){this->color = color;    this->point = point;}Card::Card(string point){this->color = "";    this->point = point;}void Card::display(){string s = this->color + this->point;    cout<<Spoint])coutpointcolor])coutpoint<<ENDL;ELSE color])coutpoint<<ENDL;ELSECOUTpoint<<endl;}}cards::cards(){string colors[]={"黑心", "紅心", "草花", "方塊"};    string numbers[]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};    for(int i=0;i<4;i++)    {for(int j=0;j<13;j++) this-="">card.push_back(Card(colors[i], numbers[j]));        }    }    this->card.push_back(Card("", "大王"));    this->card.push_back(Card("", "小王"));}void Cards::shufflePoker(){srand((unsigned int)time(0));random_shuffle(this->card.begin(), this->card.end());}void Cards::display_all(){for(int i=0;i<CARD.SIZE();I++) --="" {cout<card[i].color;cout<card[i].point + "\t";    }    cout<cout<<"初始化撲克牌:"<

運(yùn)行結(jié)果

責(zé)任編輯:

標(biāo)簽:

相關(guān)推薦:

精彩放送:

新聞聚焦
Top 主站蜘蛛池模板: 肥东县| 宁晋县| 收藏| 民权县| 宁晋县| 措勤县| 海宁市| 西吉县| 商水县| 云阳县| 六安市| 巴林左旗| 泽普县| 姚安县| 阿克陶县| 遂溪县| 罗平县| 湖口县| 东乌珠穆沁旗| 冀州市| 鹿泉市| 金寨县| 玉溪市| 谢通门县| 西昌市| 哈巴河县| 连南| 兴海县| 永济市| 高雄市| 融水| 怀柔区| 浦县| 宜丰县| 阳山县| 秦皇岛市| 阆中市| 平定县| 临沭县| 昭苏县| 安阳市|