I wrote the following program to answer the question:

Write a program that simulates the rolling of two dice. The program should use rand to roll the first die and should use rand again to roll the second die. The sum of the two values should then be calculated. Note: Since 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 being the least frequent sums. There are 36 possible combinations of the two dice. Your program should roll the two dice 36,000 times. Use a single-subscripted 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).

But its not executing properly please help URGENTLY.

#include<iostream.h>

#include<iomanip.h>

#include<stdlib.h.>

#include<time.h>

int rollDice(void);

int sum;

int main()

{

const int arraysize=12;

int frequencyOfSum[]={0};

for (int roll=1;roll<=36000;roll++)

{ rollDice();

++frequencyOfSum[rollDice()];

}

cout<<"Sum"<<setw(10)<<"Frequency"<<endl;

for(sum=2;sum<=arraysize;sum++)

cout<<setw(4)<<sum<<setw(14)<<frequencyOfSum[rollDice()]<<endl;

return 0;

}

int rollDice(void)

{

srand(time(0));

int die1,die2;

die1=1+rand()%6;

die2=1+rand()%6;

sum=die1+die2;

return sum;

}