乙個C 的21點(BlackJack)遊戲

2021-08-18 12:27:36 字數 3488 閱讀 4196

#ifndef poker_h_

#define poker_h_

//suits: games any of the four sets of 13 playing cards

//(clubs, diamonds, hearts, and spades) in a standard deck,

//the members of which bear the same marks.

//紅桃 : h - heart 桃心(象形), 代表愛情

//黑桃 : s - spade 橄欖葉(象形), 代表和平

//方塊 : d - diamond 鑽石(形同意合), 代表財富

//梅花 : c - club 三葉草(象形), 代表幸運

#include #include #include #include #include using namespace std;

struct card

;class poker

; const string point[13] = ;

private:

card card[52];

static int num;

public:

poker();

void randompoker();

card& dealpoker();

};#endif

#include "poker.h"

int poker::num = 0;

poker::poker()

}void poker::randompoker()

}card& poker::dealpoker()

#include "poker.h"

void showblackjack(const card, int);

bool bustblackjack(const card, int);

void winblackjack(const card, const card, int);

int main()

cout << "【莊家】";

showblackjack(dealer, 1);

cout << endl;

cout << "【玩家】";

showblackjack(player, count);

cout << endl;

cout << "是否繼續發牌?(y發牌/n結束): ";

char ch;

while (cin >> ch)

switch (ch)

cout << "再來一局?(c繼續/q退出): ";

if (cin >> ch && ch == 'c')

cout << "【莊家】";

showblackjack(dealer, 1);

cout << endl;

cout << "【玩家】";

showblackjack(player, count);

cout << endl;

cout << "是否繼續發牌?(y發牌/n結束): ";

continue;

} else if (ch == 'q')

break;

} system("pause");

return 0;

}void showblackjack(const card c, int n)

}bool bustblackjack(const card c, int n)

else if (c[i].point == "2")

else if (c[i].point == "3")

else if (c[i].point == "4")

else if (c[i].point == "5")

else if (c[i].point == "6")

else if (c[i].point == "7")

else if (c[i].point == "8")

else if (c[i].point == "9")

else if (c[i].point == "10")

else if (c[i].point == "j")

else if (c[i].point == "q")

else if (c[i].point == "k")

}if (count_c1 > 21)

return false;

}void winblackjack(const card c, const card d, int n)

else if (c[i].point == "2")

else if (c[i].point == "3")

else if (c[i].point == "4")

else if (c[i].point == "5")

else if (c[i].point == "6")

else if (c[i].point == "7")

else if (c[i].point == "8")

else if (c[i].point == "9")

else if (c[i].point == "10")

else if (c[i].point == "j")

else if (c[i].point == "q")

else if (c[i].point == "k")

if (d[i].point == "a")

else if (d[i].point == "2")

else if (d[i].point == "3")

else if (d[i].point == "4")

else if (d[i].point == "5")

else if (d[i].point == "6")

else if (d[i].point == "7")

else if (d[i].point == "8")

else if (d[i].point == "9")

else if (d[i].point == "10")

else if (d[i].point == "j")

else if (d[i].point == "q")

else if (d[i].point == "k")

}if (count_c1 < count_c2 && count_c2 <= 21)

count_c1 = count_c2;

if (count_d1 < count_d2 && count_d2 <= 21)

count_d1 = count_d2;

if (count_c1 > 21)

else if (count_c1 >= count_d1)

else if (count_c1 < count_d1)

}

Unity乙個點繞另乙個點旋轉

引數 vector3 point 要旋轉的點 vector3 pivot 中心點 vector3 euler 旋轉的角度 函式 quaternion.euler float x,float y,float z 返回乙個繞z軸旋轉z度 圍繞x軸旋轉x度 圍繞y軸旋轉y度的旋轉。另乙個過載函式quate...

配置乙個Struts2 1 程式

首先第一步,用myeclipse建立乙個web專案 color green 引入基本的jar包,這些包可以在struts目錄下的空專案中找到 color img color green 引入struts.xml配置檔案,從那個示例空專案中複製黏貼,放在src目錄下 color color green...

2 1 開始乙個專案 功能梳理

專案名稱 部落格 blog 專案需求 3.管理員後台 管理使用者等一系列功能 專案梳理 按照atm的設計思路 user頻道功能需求 1.登陸註冊找回密碼等一系列相關的功能 2.文章的增刪改查等功能 頻道梳理 登陸註冊作為module進行設計,命名為account 文章管理也作為module進行設計,...