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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started