Question: Solve Using C++ Problem B: Simulating a simple coin-flip game (20 Points) In this problem, you will write a program that simulates a simple 2-person
Solve Using C++ 
Problem B: Simulating a simple coin-flip game (20 Points) In this problem, you will write a program that simulates a simple 2-person coin-flip game, defined here: each player (that is, the user and computer) has after the n rounds of coin-flip. 5. Steps 2 through 5 above (after setting the random seed and allocating 100 dollars apiece to the user and the computer) should be in a do-while comtinuation loop. In other words, the first allocation of 100 dollars happened once when you start the program and should not be reset after each game. L. As with problem A above, in order to control the execution of this "random" program, you need to set up the random number generator so that it can repeat the sequence of numbers it generates-this will enable us you (and us) to test your program. To accomplish this, your program will ask the user to input a number used as a seed for the (of type int) for the predefined random number generator rand, and call the random number seed function srand with that input number as its argument. Specifically, right after the variable declarations in your program you should have the following sequence of statements: Below is a sample run illustrating what the input to and output from your program should be similar to (user input is in bold font) after your program compiles without syntax, semantic, or run-time crrors Enter a seed value for the random number generator: 246 To begin, you and your adversary, the conputer, each have 100 dollars How many rounds would you like to play1000): 50 cout > seed; srand (seed) Your wins: 24 Computer Wins: 26 Your total dollars after qames: 102 Computer's total dollars after ganes: 98 Your program should then behave as follows: Enter "y' or Y' to repeat this process: y Allocate the user and the computer (the user's adversary in this game) 100 dollars each for the entire match. 1. How many rounds would you like to play {1-1000): 100 Your wins: 48 Computer Wins: 52 Your total dollars after games: 84 Computer's total dollars after ganes: 116 2. Ask the user how many rounds (n) of coin-flip that they would like to play Enter 'y' or 'Y" to repeat this process: y Check to make sure that the user has entered a number n that adheres to the mathematical constraint: 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
