Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C Programming Language Dice have 6 faces: 1 through 6. A pair of dice when rolled can sum to any value from 2 through

Use C Programming Language

Dice have 6 faces: 1 through 6.

A pair of dice when rolled can sum to any value from 2 through 12.

The dice sum is 2 if both dice stop with the up-turned face showing 1.

The dice sum is 3 if the dice stop with one up-turned face showing 1 and the other showing 2. etc..

Write a program to randomly roll a pair of dice N times. The number of rolls will be entered by the user.

1)Your program will keep track of the number of occurrences of each face of the dice: 1-6. When the pair of dice are rolled, your program will generate two outcomes 1-6.

2) Your program will also keep track of the number of outcomes of each possible dice sum: 2 through 12.

3) Your program will write out the results from the N dice rolls to the screen: that is the totals from 1) and 2) above.

4) Your main program will call a subroutine each time the dice are to be rolled. The subroutine will return two up-turned face values 1-6 to the main program. Use an int vector as a parameter of the subroutine.

5) Your main program will keep track of outcomes and implement 3) above.

6) Use the rand() function in your subroutine.

7) In your main program, seed the rand() function using the srand() function with the argument being the time srand((unsigned int)time(NULL));

Make sure to #include as a preprocessor

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_2

Step: 3

blur-text-image_3

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago