本文想详细给出了扑克牌的C++程序并实现 我们常玩的就是没人三张牌比大小,规则是同花顺最大,一次是炸弹、顺子、同花、对子、单张
单张A 最大,以下是C++程序: // DeckOfCards
h #ifndef DECKOFCARDS_H #define DECKOFCARDS_H class DeckOfCards { public: DeckOfCards(); void deal(); void shullfe(); void getValue(); // 计算得分 int getsameColour();// 同花 int getStraigh(); // 顺子 int getStraightAndColoursOrNot(); // 同花顺 或非同花 非顺子 int getPairOrsameValue(); // 对子 或炸弹 void output(); private: int Deck[4][13]; int colourA; int colourB; int colourC; int colourD; }; #endif // DeckOfCards
cpp // ½Ìѵ Ö»Òª²»ÊÇvoidÀàÐͺ¯Êý±ØÐëÓзµ»ØÖµ£¬×¢Ò⣺intÀàÐÍ Ä¬ÈÏ·µ»ØÖµÎª1 #include using std::cout; using std::endl; using std::left; using std::right; #include using std::setw; #include // using std::rand; // using std::srand; #include // using std::time; #include"DeckOfCards
h" static int get[2][3]={0};