Question: Specification Your program will run a simulation of a game of chance. Consider the following simple dice game Game Rules: You pick a number from

 Specification Your program will run a simulation of a game ofchance. Consider the following simple dice game Game Rules: You pick anumber from 1 to 6, and call this number your point. You

Specification Your program will run a simulation of a game of chance. Consider the following simple dice game Game Rules: You pick a number from 1 to 6, and call this number your point. You then roll a die 3 times. If there is any match with your point, then you win $1; otherwise you pay the house $1 Program Development: Task 1. Design a program to simulate one play of this game. You will need a simple function roll Die0 that returns a random integer in range 1-6. Remember, to utilize random numbers you need to do three things. 1 include 2. srand (time (NULL) ll Seed the random number, do this once, in main 3. rand Call rand to get a random number between 0 and INT MAX Task 2. If your game works correctly you should then design a loop control structure that keeps repeating the game, and tracks the number of wins and losses. The loop should continue until the user enters in an appropriate sentinel value, such as the character 'x' for exit. Verify that the program runs properly, and as expected, before continuing Task 3. Modify the code so that you encapsulate the logic of the game into a single function. The function should have a prototype bool play One Game The function should return the true if the game is won by the user, and returns false if game is lost. Note that you do not need to change the basic logic of the original program to design your function. Test your function with a driver program that prints the results of

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!