Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS111 Lab Written By Kazumi Slott Due at the end of today's lab craps.cp Make a program that will simulate the game of craps. Roll

image text in transcribed
image text in transcribed
CS111 Lab Written By Kazumi Slott Due at the end of today's lab craps.cp Make a program that will simulate the game of craps. Roll a pair of dice first roll Iffirst roll is 7 or 11, ?"win" If first roll is 2, 3, or 12,"lose" If first roll is something else, keep rolling until you get 7 or the same total as first roll: 7 lose Same as first roll wirn Examples: First roll-11 ? win ! First roll-3 ? lose | First roll " 6 First roll 8 10 12 7lose 6-2 win Use a do-while loop Make a function called rollDice that simulates rolling a pair of dice. It returns a random number between 2 and 12. ?222 rollDice(????) ?7?22?m22 To simulate a roll of dice, think of 2 separate dice Die 1 Die 2 roll-(rand() % 6 + l) + ?randow6Hlik tise this one generaics a random number between I and 6 The following simulates 1 big die that has I1 sides from 2 to 12. roll-(rand() % 1 1 + 2); (-Don't use this generates a random number between 2 and 12

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

More Books

Students also viewed these Databases questions