0
How to use or rand(); function in Visual studio
Srand(time(0)); is show error in Visual studio . help me to slove problem.
3 Answers
+ 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))
0
I'm missing the parentheses in post not in complier .
My compiler show the error in "time"
Visual studio 2012
0
try running same code in some other compiler. you can use website compiler