Problems with srand(), C++

前端 未结 5 805
被撕碎了的回忆
被撕碎了的回忆 2021-01-28 23:30

I\'m trying to write a program that generates a pseudorandom numbers using a seed. However, I\'m running into problems.

I get this error

39 C:\\Dev-Cpp\         


        
5条回答
  •  自闭症患者
    2021-01-28 23:47

    srand returns void function and doesn't return a value.

    Here you can see more about it. You'll just have to call srand(9) and get the value of rand() after that, like J-16 SDiZ pointed out, who will be upvoted for this :)

提交回复
热议问题