News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

problem with random function

Started by thebestitme, April 12, 2019, 11:16:17 AM

Previous topic - Next topic

thebestitme

Hello , I have a problem with random function. First, I have to explain that I make a question and random it.
I  use 
srand(time(NULL));
QUIZ = rand()%38;
but it always show question no. 36 then I answer it shows another question.

If I delete it to have only question no. 0-35 , it doesn't has any problem although I use the same code.

https://www.img.in.th/images/51327cfda1b4948729a1f110f72f6842.png

https://www.img.in.th/images/639216882954c3b51809100ccb6dc936.png

thank you

thebestitme

I try not to use (Z==36)  so I skip it to the next number and it works !

sodev

This is not a Solve-My-Homework forum, as can be seen on the screenshots your CodeBlocks is working fine. So not a CodeBlocks problem, wrong forum, you have to look somewhere else.