0

How to use or rand(); function in Visual studio

Srand(time(0)); is show error in Visual studio . help me to slove problem.

8th Dec 2019, 3:36 AM
Shaheeq
Shaheeq - avatar
3 Respostas
+ 2
#include <iostream> #include <cstdlib> #include <ctime> using namesoace std; int main(){ srand(time(0)); return 0; } use this instead: srand(time(nullptr)); nullptr is c++ null constant. you forget to close your first parenthesis srand(time(0) should be like this srand(time(0))
8th Dec 2019, 4:51 AM
minirkk
minirkk - avatar
0
I'm missing the parentheses in post not in complier . My compiler show the error in "time" Visual studio 2012
8th Dec 2019, 12:31 PM
Shaheeq
Shaheeq - avatar
0
try running same code in some other compiler. you can use website compiler
8th Dec 2019, 7:21 PM
minirkk
minirkk - avatar