For this assignment you will have to investigate the use of


For this assignment you will have to investigate the use of the C++ random generator function, rand(). Rand() produces a random integer in the range of 0 to RAND_MAX (a constant -- often 32767 -- defined in the stdlib, automatically included in all of your projects). You can find this in the text or using the online resources given in the lectures.

OPTION A (Basic) A Slot Machine Simulation

Understand the Application

What it Looks Like to the User

The program will loop, asking the user for a bet amount from 0 to 50 (assume dollars, you can use ints or longs). If the user types a 0 that means she wants to quit. Otherwise, accept the amount as their bet and simulate a slot machine pull. Your program will print out a line that looks like a slot machine result containing three strings. Some examples are: BAR 7 BAR, 7 7 cherries, cherries BAR space, space BAR BAR, or cherries cherries BAR.

Each of the three positions in the string could be one of the following: "BAR", "7", "cherries" or "space".

Each of the three output positions is must be generated by your program randomly with probabilities:

BAR (40%)

cherries (30%)

space (5%)

7 (25%)

Therefore, BAR should be the most frequent symbol seen and space or 7 the least frequent.

The following combinations should pay the bet as shown (note ORDER MATTERS):

cherries [not cherries] [any] pays 5 × bet (5 times the bet)

cherries cherries [not cherries] pays 15 × bet

cherries cherries cherries pays 30 × bet

BAR BAR BARpays 50 × bet

7 7 7 pays 100 × bet

After the pull, display the three strings regardless of the outcome. If the user did not win, tell him/her "Sorry, you lose." If he won, pay him by displaying his winnings (his original bet times the winning factor from the above table). Then, repeat the whole process by requesting another bet amount.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: For this assignment you will have to investigate the use of
Reference No:- TGS01093390

Expected delivery within 24 Hours