0

Help fixing error

Something to do with generating random numbers https://code.sololearn.com/c6tP8mUtjoKH/?ref=app

27th Feb 2019, 5:54 PM
Agaba Edwin
Agaba Edwin - avatar
3 Answers
+ 4
The error is due to the type mismatch of long and time_t (alias of long long). So, declare sec as a variable of type time_t: time_t sec; time(&sec); ... It is also possible to directly call time inside srand with a null pointer as time's argument, like this: srand(time(nullptr));
27th Feb 2019, 6:33 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 3
Thank you so much. I have rectified the error. Your answers were helpful, Kinshuk and Julien
27th Feb 2019, 7:23 PM
Agaba Edwin
Agaba Edwin - avatar