Closed Tommac1 closed 6 years ago
I'm not really convinced to for loop nested in do-while loop. I'd rather another array containing already taken int's and checking if picked int is not in that array
do w/e you want
@Tommac1 I've changed the code according to your suggestion, thanks!
Requirement was, that for every int field, it's value must be unique .
Consider adding the following code to make it done
do { structs[i]->i = (rand() % 10001) - 1000; present = 0; for (j = 0; (j < i) && (present == 0); ++j) { if (structs[j]->i == structs[i]->i) { present = 1; } } } while (present == 1);
EDIT Please describe issue mode in detail when submitting ~VanDavv