根据之前发表的文章《c# 扑克牌程序(1) 一副扑克牌可以选择是否包含大小王》中提供的类库,引用它。
具体功能为:从打乱顺序(洗牌)的一副牌中一次取出5张牌,如果这5张牌是同花,就提示。
否则,在取出50张牌后停止。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ch10CardLib; //类库
namespace test1095
{
class Program
{
static void Main(string[] args)
{
int wCount = 0;
while (true)
{
wCount++;
Deck playDeck = new Deck(); //实例化Deck类
playDeck.Shuffle(); //洗牌
bool isFlush = false; //实例一个bool值并初始化为false用于记录是否4张牌是同花
int flushHandIndex = 0; //连续5张同花牌中第一张牌的索引位置
int count = 0;
for (int hand = 0; hand < 10; hand++)

本文利用之前创建的C#扑克牌类库,设计一个程序,从洗牌后的一副扑克中依次抽取5张牌,若这5张牌构成同花顺,程序将提示;若在抽取50次后仍未出现同花顺,程序则停止。
最低0.47元/天 解锁文章
935

被折叠的 条评论
为什么被折叠?



