+ 4

Quiz Rejected 2

//invalid code z cannot be which of the following? int x=5; int z=random(random(random(x))); select all that apply . 15 0 3 5 can anyone explain what's wrong in it ?

24th Mar 2017, 11:20 AM
Sahaj Bamba
Sahaj Bamba - avatar
3 Answers
+ 17
random() and randomise() functions are not part of the standard​ libraries in C++. That's probably why. Have you tried running this on a desktop compiler? The alternative that I suggest is to simply replace random() with proper usage of rand(). E.g. int z = rand() % (rand() % (rand() % x)); P.S. The answer is 15 and 5 right?
24th Mar 2017, 12:06 PM
Hatsy Rei
Hatsy Rei - avatar
+ 15
You got me good. =^=
24th Mar 2017, 12:36 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
answer is 5 ,15 and 3
24th Mar 2017, 12:35 PM
Sahaj Bamba
Sahaj Bamba - avatar