C programming craps game
Whereas it is supposed to show out of how many times the program won and how many times it lost. Is anybody able to help me out with this please? The next problem is that you seem to have a misunderstanding about how works.
It looks like you want to check if r is either 7 or 11 which would actually be:. As far as I can tell you probably meant the while to be this:.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 8 years, 9 months ago. Active 8 years, 9 months ago. Viewed 8k times.
Improve this question. Kane Charles. Kane Charles Kane Charles 2 2 gold badges 10 10 silver badges 19 19 bronze badges. I wanna make a craps game in C. Would somebody help me by showing the souce code, please The craps game has the following rules: 1. Roll 2 dices 2. If the first roll produces 7 or 11, you win the game. If you roll 2,3, or 12 then you lose the game. Other than that number will become your point.
Then do your next roll until you get either your point or 7 you lose the game. The program must ask the player to enter the amount of bet. If the player wins, the player will win double of the amount of bet. If the player loses, the player will lose all the money. If they roll a 2, 3, or 12, they lose. If the 1st roll is not a win or a loss, the player's first roll becomes the 'point' value. The player then rolls again and again until either a 7 is rolled rolling player loses or the 'point' value is rolled a second time rolling player wins.
Can someone please help me?? Thanks Here is my program: Code:. Read the part of your book that talks about switch and case.
No need to check if the dice roll is indeterminate. You may want to look into using a jump table rather than if statements because it could be more efficient in cases like this where the input dice roll is tightly packed integers. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Craps game in c Ask Question. Asked 1 year, 8 months ago.
Active 1 year, 8 months ago. Viewed times. First of all, I'm really sorry for my bad English I tried to explain the problem as much as I can Craps game in c The computer rolls two dice and if the result is 7 or 11 you directly win or the result is 2,3 and 12 you directly lose.
Dices are rolling R dices are rolling
0コメント