1. ## Dice Function..

int getDice()

I am trying to write a function to return the value of a thrown dice. the function will return the dice value, a number between 1 and 6.

i know you use the srand and the rand and make the function output it but i don't really know how to write that.

2. I will offer ye' one method:

first.. create pair of dice:
Code:
```struct PairOfDice
{
int dice_1;
int dice_2;
}```

let's prototype a dice roll function that will handle this new 'PairOfDice' data type..
Code:
`PairOfDice* roll_the_dice(PairOfDice &DiceStruct) ;`

in your int main( ) function, declare an object of type PairOfDice:
Code:
`PairOfDice *myDice ;`

then, when you are ready.. roll the dice..!
Code:
`myDice = roll_the_dice(myDice) ;`

and now you have.. a pair o' dice
Code:
```cout << "Roll 1 is:  "  <<  myDice->dice_1 ;
cout << "Roll 2 is:  "  <<  myDice->dice_2 ;```

Now.. all you have to do is write up the function definition.. not too hard.. just randomly set the two attributes of the 'PairOfDice' object.

OOP goodness

3. Originally Posted by The Brain
I will offer ye' one method:

Now.. all you have to do is write up the function definition.. not too hard.. just randomly set the two attributes of the 'PairOfDice' object.. include a provision to make sure that dice_1 != dice_2
what? you've never rolled 2 dice and got the same result on each die?

besides that wasn't what the OP was asking at all.

OP, I could tell you how to write a function which uses rand to return a value between 1 and 6, but I'd prefer you to try yourself first.

Hint: you'll need to use the % modulo operator (aka the remainder operator).