Ok so I want it so whenever I put in the command roll_dice it will print out 5 random numbers. I figured I was going to run across this problem. But whenever I use the function "roll_dice" it just print's out the same number's each time, like if I print them out twice during the program. Here is the function.
It should print out 5 random number's each time I use the function, but it print's out the same ones.Code:int roll_dice() { int dice[5]; srand(time(NULL)); dice[1]=rand()%6+1; dice[2]=rand()%6+1; dice[3]=rand()%6+1; dice[4]=rand()%6+1; dice[5]=rand()%6+1; cout<<dice[1]; cout<<dice[2]; cout<<dice[3]; cout<<dice[4]; cout<<dice[5]; }