Write a program that simulates the rolling of two dice

Assignment Help C/C++ Programming
Reference no: EM132118577

Assignment -

1. Dice rolling:

Write a program that simulates the rolling of two dice. 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.] The following table shows the 36 possible combinations of the two dice. Your program should roll the two dice 36,000,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 (i.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

1

2

3

4

5

6

7

2

3

4

5

6

7

8

3

4

5

6

7

8

9

4

5

6

7

8

9

10

5

6

7

8

9

10

11

6

7

8

9

10

11

12

2. For each of the following, write C++ statements that perform the specified task. Assume that unsigned integers are stored in four bytes and that the starting address of the built-in array is at location 1002500 in memory.

a. Declare an unsigned int built-in array values with five elements initialized to the even integers from 2 to 10. Assume that the constant size has been defined as 5.

b. Declare a pointer vPtr that points to an object of type unsigned int.

c. Use a for statement to display the elements of built-in array values using array subscript notation.

d. Write two separate statements that assign the starting address of built-in array values to pointer variable vPtr.

e. Use a for statement to display the elements of built-in array values using pointer/offset notation.

f. Use a for statement to display the elements of built-in array values using pointer/offset notation with the built-in array's name as the pointer.

g. Use a for statement to display the elements of built-in array values by subscripting the pointer to the built-in array.

h. Refer to the fifth element of values using array subscript notation, pointer/offset notation with the built-in array's name as the pointer, pointer subscript notation and pointer/offset notation.

i. What address is referenced by vPtr + 3? What value is stored at that location?

j. Assuming that vPtr points to values[4], what address is referenced by vPtr -= 4? What value is stored at that location?

Reference no: EM132118577

Questions Cloud

Good measure of central tendency : Give an example of a variable or a frequency distribution that might best be summarized by some other measure of central tendency.
Distribution cost of the current distribution system : What is the annual inventory and distribution cost of the current distribution system?
Explain your personal writing process : Explain your personal writing process. What has worked for you in your effort to produce quality documents? What is your biggest writing challenge?
Descriptive statistics for the variable work by gender : Based on the descriptive statistics for the variable Work by Gender answer and explain the following questions:
Write a program that simulates the rolling of two dice : CS3528 Assignment - Write a program that simulates the rolling of two dice. The sum of the two values should then be calculated
Explain the position known as moral relativism : Explain the position known as moral relativism. Do you agree or disagree with this view? Justify your position with two reasons.
Should merit-an appointees legal credentials : Should merit-an appointees legal credentials-will be greater weight - And what is your view about partisan considerations have increasingly influenced
Loose threads or has crooked stitching : Of the shirts produced by a company, 5.5% have loose threads, 8.5% have crooked stitching, and 3.5% have loose threads and crooked stitching.
Replacement for a commercial : If you select three customers without replacement for a commercial, what is the probability they will all say they are happy with the service?

Reviews

len2118577

9/21/2018 1:41:07 AM

This is c++ programming assignment the last time I asked for help it was hard for me to open the file is there a way that the code can be typed on a notepad or ms-word but in sequential. Thank you.

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd