Hey, im pretty new, and exploring C++, not the best started programming i know, but anyway..
I want to make a simple program with a random number between 1 and 3, im not too sure how to do this. Any help would be great.
Printable View
Hey, im pretty new, and exploring C++, not the best started programming i know, but anyway..
I want to make a simple program with a random number between 1 and 3, im not too sure how to do this. Any help would be great.
srand(time(NULL)); //Just put this in, you need it
x=1 + rand() % 3 //Random number 1 through 3
make sure you know how the modulus operator works.