Hi, I am new at c++ and am currently trying to write a function that throws 10 six-faced dices. However, I need to use the results of the dice throws in another function (that puts them in an array). How can I achieve that. For now this is the only thing I have:
int diceThrow()
{
srand((unsigned)time(0));
int a;
int lowest=1, highest=6;
int range=(highest-lowest)+1;
for(int index=0; index<10; index++){
a = lowest+int(range*rand()/(RAND_MAX + 1.0));
cout << a << endl;
}}
As you can see, this function can only tell me what the results are and can't return them to another function.