早教吧 育儿知识 作业答案 考试题库 百科 知识分享

请问如何比较两组各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.
▼优质解答
答案和解析
1.给每个玩家分配随机数
//Player1
for(int i=0;i