I don't know where to begin..

Hi everyone,

I am fairly new to C++ and I have been given a hw assignment that I have no idea how to start. Any feedback and help would be greatly appreciated! Here are the instructions:
Pair of dice simulation
Write a program that simulates rolling two dice 1,000 times and reports to the user the average sum of the two dice over the 1,000 rolls.
To make it interesting, the user inputs the number of sides on each of the two dice seperately so they can be different (e.g. a 5 sided die and an 8-sided die).

You should have functions:
rollDie, getDiceSides, calculateAverage, displayResult

Here is an example of what the output should look like:

Welcome to the Pair-Of-Dice simulation! Two dice will be rolled 1000 times and their average sum will be determined.

Enter the number of sides on die 1: 5
Enter the number of sides on die 2: 8
The average sum of rolling a 5-sided die and a 8-side die a 1000 times is 7.54



Any help with this assignment would be greatly appreciated!! Thanks!
This is not a homework service. We're not going to write your program for you.

You should have functions:
rollDie, getDiceSides, calculateAverage, displayResult


You've already been given a start by identifying the major functions required.

Make an attempt to write those functions and we'll try and help if you get stuck.


for starters you will need to use the rand() srand() and time() functions together to generate random numbers. Something like this
 
srand(time(NULL)); // <-- a random number seed 


Then call the rand();

something like int dice = (rand()%6) + 1; // this will give you a six sided dice value

You will need to loop through 1000 times adding the values together and then do the same for the second die, add together and divide by 2000.

Of course you will have to add a switch case or if else block of code to determine the dice size for each.

Then its just a simple matter of outputting the result.
Thanks for all of the replies, i'll be posting my code up shortly to see if it looks somewhat correct. I really do appreciate the help as this is my first time learning how to code.
Topic archived. No new replies allowed.