Re: A task involving linked lists and a headache
Quote:
Originally Posted by MustSeeMelons
rand()%4 would give me 0-4
Actually, it will give you integers in the range [0, 3].
Re: A task involving linked lists and a headache
Re: A task involving linked lists and a headache
Quote:
Originally Posted by
MustSeeMelons
Forgot to delete that pointer for the bunny, anyway, it wasnt used.
Because, rand()%4 would give me 0-4, but those positions contain Male names, i need rand()%(14 - 10)+10 gives me 10-14, which are the names i need.
Good grief.
rand() % 4 + 10.
The (14 - 10) just evaluates to 4. Why not just write 4? Why not (107 - 103)? Keep it as simple as possible.