time - How can I get rid of the warning with rand()? (C++) -
whenever I use the Rand function in C ++:
#include & Lt; Iostream & gt; #to & lt include, time.h> #to & lt include, stdlib.h & gt; using namespace std; Int main () {srand (time (0)); Int n = (rand ()% 6) +1; Cout & lt; & Lt; "Dice is rolled" & lt; N & lt; & Lt; "." & Lt; & Lt; Andal; } I get a warning about the conversion, which is from line_ty to line 5:
srand (time (0)); Is there any way to get rid of this warning?
Actually, you should use it:
srand ( (Unsigned) time (0));
Comments
Post a Comment