Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need to write a C++ Program in microsoft visual studio 2. Write a program that simulates the rolling of two dice. The program should

image text in transcribed
image text in transcribed
i need to write a C++ Program in microsoft visual studio
2. Write a program that simulates the rolling of two dice. The program should use rand to roll the first die and should use rand again to roll the second die. The sum of the two values should then be calculated. (Note: Each die can show an integer value from 1 to 6, so the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 being the least frequent sums.) Figure 7.32 shows the 36 possible combinations of the two dice. Your program should roll the two dice 36,000 times. Use a one-dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable (.e, there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7). 1 2 3 4 5 6 2 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 4 5 6 7 8 9 10 S 6 7 8 9 10 11 10 11 12 6 7 8 9 Sampe Output Sum 2 3 4 5 6 Total Expected 983 2.778% 1918 5.556% 2952 8.333% 4138 11.111% 4964 13.889% 5952 16.667% 5062 13.889% 4007 11.111% 3071 8.333% 2007 5.556% 946 2.778% Actual 2.731% 5.328% 8.200% 11.494% 13.789% 16.533% 14.061% 11.131% 8.531% 5.575% 2.628% 8 10 11 12

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions