Question: I'm stuck. Need help. C++ Write a complete C++ program that will simulate the throwing of 2 dice: The program will ask the user to

 I'm stuck. Need help. C++ Write a complete C++ program that
I'm stuck. Need help.
C++

Write a complete C++ program that will simulate the throwing of 2 dice: The program will ask the user to choose a number in the range of 2-12 (possible values for 2 dice). The program will then simulate rolling the 2 dice until the user's number is found and keep track of how many throws it took to get that number. In order to get a more accurate number of throws, the experiment will be repeated a number of times. So, the user must also enter how many times they want to run the experiment. Specifically, Ask the user for the number that they would like to roll. Use a loop to make sure that the user's response is in the 2-12 range. Give an error message if an invalid number is entered, and then repeat the input until a valid value is entered. Ask the user how many times they would like to run the roll counting experiment. Use a loop to make sure that the user's response is at least 1. Give an error message if an invalid number is entered, and then repeat the input until a valid value is entered. To run the experiment: get 2 random dice rolls and add their values together in a loop, count how many rolls it takes to get the user's target value Repeat the count rolling experiment, keeping track of the total number of rolls, until the number of repetitions value has been reached. Write out the number of rolls for each time the experiment is run, and the average number of rolls that it took to find the user's number. (see the examples below for a suggested format). Comments: Block at beginning of file must contain: name, lab section, program number. sample runs: Enter a number between 2 and 12: 8 How many tries do you want? 5 found 8 on roll 1 found 8 on roll 12 found 8 on roll 7 found 8 on roll 15 found 8 on roll 1 In 5 tries, found 8 in an average of 7.2 rolls Enter a number between 2 and 12: 3 How many tries do you want? 9 found 3 on roll 8 found 3 on roll 9 found 3 on roll 14 found 3 on roll 64 found 3 on roll 3 found 3 on roll 16 found 3 on roll 10 found 3 on roll 8 found 3 on roll 21 In 9 tries, found 3 in an average of 17.0 rolls

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!