Question: How do I write simple C program that rolls a single 6 sided die in a betting game against the house? The basic algorithm for

How do I write simple C program that rolls a single 6 sided die in a betting game against the house?

The basic algorithm for Dice:

* Starts with $100 balance and loops until player is out of money.

1. Print to screen "Welcome to Dice" 2. Money > 0 true: continue to number 3 false: output "You lost all your money. Game over" Go to number 11 3. Print to screen "Enter your bet" 4. Scan in bet 5. Random player roll (random(6) 6. Random calculate house roll (random(6) 7. Output "You rolled a &player" 8. Output "House rolled a &house" 9. Check player > house true: balance += bet

output "You win!"

false: balance -= bet

output "You lose!"

10. Go back to (loop)

11. End Program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!