+ 2
Anyone know to randomize values in c++
4 Antworten
+ 6
Use:
<include ctime>
srand(time(0)):
int random = rand();
+ 9
For example if you want a random number between 1 and 6(maybe for a dice game):
#include <ctime>
srand(time(0));
int diceNumber = 1 + rand() % 6;
+ 1
how to give the output of two variables .can u give an example using two variable
+ 1
thanks