help plzz

: Let us roll dice
Write a program that simulates the rolling of two dice. The program should use the function rand() to roll the first die and use rand() again to roll the second die. The sum of the two values should then be claculated (possible values are 2, 3, …, 12). Your program should roll the two dice 20000 times. Use an array named roll (initialised to 0’s) to tally (to record the number of occurences) each possible sum value. Calculate the relative frequency of each sum value as follows: devide the sum value by 20000, multiply by 100 and floor the result. Save the results in an array named frequency. Print the array frequency as a histogram of stars.
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
  #include <iostream>

using namespace std;

int main ()
{
    int roll[12] = {0,0,0,0,0,0,0,0,0,0,0,0};

    int rand();
    int die1;
    int die2;
    int sum = 0;
    int freq = 0;

    for (int i=0; i<20000; i++)
    {
        die1 = rand() % 6 + 1;
        die2 = rand() % 6 + 1;
    }

    sum = die1 + die2;




    return 0;
}


thats what i did... i really need help i also dont know how to print the array as histogram of stars
Topic archived. No new replies allowed.