0
Could it be that the exemplary solution to C++ practise 39.2 does not match the problem description?
The problem asks for 4 integer values from the interval [0;range]. The code gives values from the interval [1;range]. Solution: replace "1+rand()%range" with "rand()%(range+1)" or change the problem description and test values.
1 ответ
+ 2
Yes, the cases are only solvable when the generated random numbers were within the bounds 1 ~ <N>. Trying with random numbers within range 0 ~ <N> failed miserably : )
Probably better send this corrective note by e-mail rather than to post it here. The devs barely have the time watching over the forum.
Nice observation!