I am making a game with C++ and i need to generate 5 random numbers, and keep track of them. I have tried searching for other people trying to do this but i haven't found anyone similar. Anyway, here is the current code of the random thingy:
1 2 3 4 5 6
void roll() {
srand(time(0));
for (int x = 1; x <= 5; x++) {
cout << (rand() % 6 + 1) << endl;
}
}
Thank you for your reply, however I want to keep track of all 5 numbers in 5 different variables. I guess I wasn't clear enough, sorry.
And also I have never worked with vector, so im kinda lost in that2.