Exercise from the book learning coding the hard way.