开发者

Game of Pig function repeating?

For homework we are suppose to progrma a pig game which adds up to 100 points and then declares a winner or loser. The problem im having is when the person rolls a 1 for some reason开发者_C百科 it rolls again and doesnt go to the computer and lets it roll. I cant figure out what is happening, if the user rolls one it automatically just rolls agian for him.


As shuttle87 says, your int functions don't return anything. Change them to return void isntead.

As for your problem: http://ideone.com/EEkvy During my test, I rolled 1 three times, one of which the computer rolled after, and twice I got two turns in a row. I'd guess this is because the computer also rolled one, and when the computer rolls one, nothing is displayed on the screen.

I've seen this game before. Isn't the player supposed to only keep their points when they hold?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜