0

Why always 41 ?

31st Aug 2017, 6:07 PM
harsh jaiswal
harsh jaiswal - avatar
2 odpowiedzi
+ 11
Because you forgotten to seed the built-in RNG algorithm using srand(). #include <iostream> #include <cstdlib> #include <ctime> int main() { srand(time(0)); std::cout << rand(); }
31st Aug 2017, 6:11 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
var answer = 42; --answer; ^^
31st Aug 2017, 7:09 PM
visph
visph - avatar