⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardgame-client.cpp

📁 压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架>>所有源码
💻 CPP
字号:
/* This is example code provided to the student *///start#include "carddeck.h"#include <qstd.h>using namespace qstd; /* For cout, endl, and more() */int main() {    CardDeck deck;    CardHand hand;    int handSize, playerScore, progScore;    cout << "How many cards in a hand? " << flush;    handSize = promptInt();    do {        hand = deck.deal(handSize);        cout << "Here is your hand:" << endl;        cout << hand.toString() << endl;        playerScore = hand.getValue();        cout << QString("Your score is: %1 points.")                         .arg(playerScore) << endl;        // Now a hand for the dealer:        hand = deck.deal(handSize);        progScore = hand.getValue();        cout << "Here is my hand:" << endl;        cout << hand.toString() << endl;        cout << QString("My score is: %1 points.")                         .arg(progScore) << endl;        cout << QString("%1 win!!")              .arg((playerScore > progScore)?"You":"I") << endl;    } while (more("hand"));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -