Code::Blocks Forums
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
As usual while waiting for the next release - don't forget to check the
nightly builds
in the forum.
Home
Help
Search
Login
Register
Code::Blocks Forums
»
User forums
»
Using Code::Blocks
»
problem with random function
« previous
next »
Send this topic
Print
Pages: [
1
]
Go Down
Author
Topic: problem with random function (Read 3367 times)
thebestitme
Single posting newcomer
Posts: 2
problem with random function
«
on:
April 12, 2019, 11:16:17 am »
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
Logged
thebestitme
Single posting newcomer
Posts: 2
Re: problem with random function
«
Reply #1 on:
April 12, 2019, 11:52:40 am »
I try not to use (Z==36) so I skip it to the next number and it works !
Logged
sodev
Regular
Posts: 497
Re: problem with random function
«
Reply #2 on:
April 12, 2019, 06:56:32 pm »
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.
Logged
Send this topic
Print
Pages: [
1
]
Go Up
« previous
next »
Code::Blocks Forums
»
User forums
»
Using Code::Blocks
»
problem with random function