Drill and Exercise Code
The book's Web site has some
exercise solutions , which should be used as examples of how to use
C++ in preference to the code in this directory. The code in this
directory is provided because they may well help if you get stuck, and
you are asking yourself
“How on earth can I answer this one?”
The code here was written primarily for the following purposes:
- to check that I had correctly understood what Bjarne Stroustrup
was saying and exactly what the C++ standard allows, and
- to check that doing the drills and examples was possible using
only the facilities taught up to that chapter, in the environment I
would use for teaching, and
- to check that the supplied materials would run correctly (and
preferably without warnings) in the environment I would use for
teaching.
In particular:
- they are not always written in a good style, and
- I did most of them in some chapters but only a few in others
(though I did all that looked as if they needed something new), and
- they rarely include the error checking and commenting that the
book asks for, and
- they haven't been properly tested, and some are deliberately
incorrect (to check on failure modes), and
- they don't all do the drill or exercise exactly, because I fairly
often got bored :-)
Don't do as these examples do - do as the book
says!