Hint 6

If you're stuck on how to write the part about processing the array, think about it this way:

First, ignore the fact that there are forty-nine people who come along opening and closing lockers; concern yourself only with that first person who closes every other locker. Write a loop which simulates only that first person, that is, incrementing every other position in the array.

When you have that done correctly, notice that the loop itself needs to be repeated for each person who comes along. It needs to be nested inside of a larger loop in order to account for everybody.


Thomas VanDrunen
Last modified: Mon Sep 15 16:47:28 CDT 2008