(Dice Rolling) Write a program that simulates the rolling of two dice. The program should use rand twice to roll the first die and second die, respectively. The sum of the two values should then be calculated. [Note: Because each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums.] Figure 6.24 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 rea- sonable; i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7. 6.19 1 3 4 1 2 3 4 5 7 2 3 4 5 6 7 8 5 6 7 89 3 4 4 6 7 8 9 10 7 8 9 10 11 6. 6 7 8 9. 10 11 12

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 7E: (Simulation) Write a program to simulate the roll of two dice. If the total of the two dice is 7 or...
icon
Related questions
Question
100%

Hi!

 

I need help with this homework!

(it is C prgramming )

Thank you

2.
(Dice Rolling) Write a program that simulates the rolling of two dice. The program should
use rand twice to roll the first die and second die, respectively. The sum of the two values should
then be calculated. [Note: Because each die can show an integer value from 1 to 6, then the sum of
the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least
frequent sums.] Figure 6.24 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 rea-
sonable; i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7.
6.19
2
3
4
5
6.
1
3
4
5
7
2
3 4 5 6 7 8
3
4
5
6.
7
8
9
6.
7
8
9
10
5
6.
7
8 9 10
11
6.
7
8
9.
10 11
12
2.
4-
Transcribed Image Text:2. (Dice Rolling) Write a program that simulates the rolling of two dice. The program should use rand twice to roll the first die and second die, respectively. The sum of the two values should then be calculated. [Note: Because each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums.] Figure 6.24 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 rea- sonable; i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7. 6.19 2 3 4 5 6. 1 3 4 5 7 2 3 4 5 6 7 8 3 4 5 6. 7 8 9 6. 7 8 9 10 5 6. 7 8 9 10 11 6. 7 8 9. 10 11 12 2. 4-
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Excel Sheet
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning