Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago