0

Always 41 out

24th Jan 2017, 9:15 AM
ŠŠ»ŠµŠŗсŠ°Š½Š“р Š¤ŠøŠ»ŠøŠ½
ŠŠ»ŠµŠŗсŠ°Š½Š“р Š¤ŠøŠ»ŠøŠ½ - avatar
2 Answers
+ 2
try #include <ctime> #include <cstdlib> #include <iostream> int main() { srand(time(0)); std::cout << (rand() % 5) + 1 << std::endl; return 0; } different numbers between 1-5 everytime u execute it
24th Jan 2017, 9:23 AM
Kawaii
Kawaii - avatar
+ 1
Try to first call the srand() function, with actual time as parameter: http://www.cplusplus.com/reference/cstdlib/rand/
24th Jan 2017, 9:20 AM
visph
visph - avatar