Why <time.h> is used in coin toss guessing program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why <time.h> is used in coin toss guessing program

Does <time.h > has any relation with the program, what is the key in toss=rand() %2, actually it shows rand() not declared

24th Mar 2018, 12:40 PM
Shalin Suthar
Shalin Suthar - avatar
2 Answers
+ 1
Well, can you please write and send the code SIR.....
24th Mar 2018, 12:49 PM
Shalin Suthar
Shalin Suthar - avatar
+ 5
There should be srand(time(0)) call that uses the current time to initialize the random number pattern.
24th Mar 2018, 12:47 PM
John Wells
John Wells - avatar