two dimensional array

Write a C++ program that uses a two-dimensional array to display a table of probabilities for a pair of rolling dice. Your custom assigned range of values of each die is 4 up to and including 9.

Section 1 of Program - Specifications:

The top row of the table left to right, and the left column of the array, top to bottom, must contain the assigned range of values displayed on each of the dies in ascending order populated through the use of a two-dimensional array. The table must contain a total calculation formula resulting in a sum value when each of the values on the faces of each die is added together. (See sample output below.) Array population values cannot be hard-coded into the array. Array population values must be derived from a calculation formula.

Section 2 of Program - Specifications:

After the table is populated with all of the probabilities, the program displays the possible total sum values and how many times that total sum value appears in the table. The program displays a label identifying this section of information on the output screen.

Section 3 of Program - Specifications:

Print out the array index values in brackets [ ] directly to the right of each total sum value in the table. Both the index values, an array index brackets, as well as the total sum value, must be printed.

Section 1 of the program must be completed in order to earn any points for section 3 of the program.

The completed program displays the program name and the student name at the top of the screen as well as section titles for sections 2 and 3. The output is formatted so that it is not displayed on the very first line and at the left margin of the run window. The finished table should be depicted as a table with the use of one character, repeated, so as to make the finished output table appear to be a grid.

There are notes and restrictions for each section of the program, listed below the sample output. There are grading specifications listed in, and below, the notes and restrictions sections.

Points allocations used for grading of this final exam project are listed after the notes and restrictions.
to your question here.

Here is what I have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include<iostream>

#include<time.h>

using namespace std;

int main()

{

int sumCount[6][6];

for (int i = 0; i < 6; i++)

{

for (int j = 0; j < 6; j++)

{

sumCount[i][j] = 0;

}

}

char ch='Y';

srand(time(NULL));

while (ch == 'Y' || ch =='y')

{

int dice1 = rand() % 9 + 4;

int dice2 = rand() % 9 + 4;

sumCount[dice1 - 4][dice2 - 4] += 1;

cout << "do you want to dice more enter (Y/N): ";

cin >> ch;

}

cout << "\t4\t5\t6\t7\t8\t9" << endl;

for (int i = 0; i < 6; i++)

{

cout << i+4 << "\t";

for (int j = 0; j < 6; j++)

{

cout << sumCount[i][j] <<"\t";

}

cout << endl;

}

system("pause");

return 0;

}
  
Last edited on
http://www.cplusplus.com/articles/jEywvCM9/
Edit your post to make the code presentable.
Can I please get some help with this assignment. Any help would be appreciated.
int dice1 = rand() % 9 + 4; This gives a range of 4 to 12. It is a 9-sided die.

For a range of 4 - 9 use int dice1 = rand() % 6 + 4;
Topic archived. No new replies allowed.