早教吧作业答案频道 -->其他-->
请问如何比较两组各5个数字的大小。我在做一个骰子游戏,比它们的大小。每个玩家各有5个随机数,请各如何写一个函数来比较这两个玩家的大小。详细规则如下:FiveofaKind--->Fivediceofo
题目详情
请问如何比较两组各5个数字的大小。
我在做一个骰子游戏,比它们的大小。
每个玩家各有5个随机数,请各如何写一个函数来比较这两个玩家的大小。
详细规则如下:
Five of a Kind--->Five dice of one number.
Four of a Kind--->Four dice of one number; plus an unmatched dice of another number.
Full House--->Three dice of one number and two dice of another number.
Straight--->Five dice of sequential number.
Three of a kind--->Three dice of the same number; plus two unmatched dice of other numbers.
Two Pair--->Two dice of the same number, two dice of another number; plus one unmatched dice.
One Pair--->Two dice of the same number; plus three other unmatched dice.
Single---->All dice of different number. The largest number will be counted.
如果两个玩家的结果是相同Kind的话,即玩家一是五个五,玩家二是五个四的话,那玩家一大于玩家二。
随机数字的范围是1到6.
我在做一个骰子游戏,比它们的大小。
每个玩家各有5个随机数,请各如何写一个函数来比较这两个玩家的大小。
详细规则如下:
Five of a Kind--->Five dice of one number.
Four of a Kind--->Four dice of one number; plus an unmatched dice of another number.
Full House--->Three dice of one number and two dice of another number.
Straight--->Five dice of sequential number.
Three of a kind--->Three dice of the same number; plus two unmatched dice of other numbers.
Two Pair--->Two dice of the same number, two dice of another number; plus one unmatched dice.
One Pair--->Two dice of the same number; plus three other unmatched dice.
Single---->All dice of different number. The largest number will be counted.
如果两个玩家的结果是相同Kind的话,即玩家一是五个五,玩家二是五个四的话,那玩家一大于玩家二。
随机数字的范围是1到6.
▼优质解答
答案和解析
1.给每个玩家分配随机数
//Player1
for(int i=0;i
//Player1
for(int i=0;i
看了 请问如何比较两组各5个数字的...的网友还看了以下:
平平,丽丽,小勇,小红和豆豆住在一个小区里,他们个子差不多,岁数相关也不大,常在一起玩,一天豆豆的 2020-05-13 …
英语大虾啊!求翻译“我在那儿玩得很开心”、“我们在海中游泳”、“我们开心玩水玩沙子” 2020-05-21 …
明天忙翻译一下在我大概5岁的时候,和祖母在外面散步,祖母坐在远处的石凳上与朋友聊天,而我就在一旁玩 2020-05-21 …
(三)阅读下面的短文,(18分)在日本,一位父亲带着6岁的儿子去郊游,父亲钓鱼,儿子在一旁玩耍.在 2020-06-12 …
男孩和他的树从前,有一棵巨大的苹果树.一个小男孩每天都喜欢在树下玩耍.他爬树,吃苹果,在树阴下小睡 2020-06-22 …
为什么呢?这就是差别?我20岁了,90后的这个年龄,大多都是疯狂的,爱玩的,而我从来没有过,我很羡慕 2020-11-02 …
红星幼儿园大一班和大二班的人数在60到70之间.两个班在一起玩游戏.分的组数正好与每组人数相红星幼儿 2020-11-20 …
男孩和他的树从前,有一棵巨大的苹果树.一个小男孩每天都喜欢在树下玩耍.他爬树,吃苹果,在树阴下小睡. 2020-12-07 …
在2012年2月举办的西半球最大的国际玩具展上,备受青睐的中国传统玩具,如毽、风筝、不倒翁等,都是经 2020-12-24 …
在2012年2月举办的西半球最大的国际玩具展上,备受青睐的中国传统玩具,如毽子、风筝、不倒翁等,都是 2020-12-24 …