Question: im in an introductory (C++) programming class and we just started learning functions and ive been having some trouble. If someone could help with this

 im in an introductory (C++) programming class and we just started

im in an introductory (C++) programming class and we just started learning functions and ive been having some trouble. If someone could help with this program and explain the code i will definitely thumbs up the answer. thank you

In this problem, you will be estimating the probability of an event by re- peated simulation. (This is called a Monte Carlo method.) We will be playing the following game. 1. The user specifies a starting position and also lower and upper limit. 2. You start at the specified starting position 2. 3. You flip a fair coin. If it is heads, you move to position r +1. If it is tails, you move to position 2-1. 4. Repeat the last step over and over again until you reach either the upper limit or the lower limit. 5. If you hit the lower limit first, you lose. If you hit the upper limit first, you win. You will ask the user for a number of trials N. Keep track of how many "wins" you get and report estimated win probability (Number of wins)/N Example output: Lower Limit: 0 Upper Limit: 100 Start Point: 50 Number of Trials: 1000 Estimated win probability: 0.503

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!