Introduction
This is the Annotated Solution Guide for the exercises in Thinking in C++,
2nd Edition, Volume 1. The book was written by Bruce Eckel and the solution
guide was written by Chuck Allison. This solution guide may be purchased
here.
This guide contains solutions for selected exercises, leaving some exercises
for the reader. You can find an online list of the exercises that have been
solved here.
This guide is distributed as a zip file containing a set of HTML files in the
subdirectory labeled html, and a source-code tree in the subdirectory code.
Linux/Unix Users: you must unzip the file using Info-Zip, which can be
found for various platforms
here or
here.
This tool often comes pre-installed on Linux distributions. When you unzip the package,
you must use the –a option to correct for the difference between DOS and Unix
newlines, like this:
unzip –a TICSolutions.zip
In the zip file that you received upon purchasing this package, you will find
a source-code directory tree that includes all the code listings shown here,
along with makefiles to build all the listings using compilers from Gnu (g++),
Borland, Microsoft or EDG (Edison Design Group).
To build the listings, you must first find and install an
appropriate make program.
Borland comes with a make, as does Cygwin which runs the
g++ compiler under Windows - see www.Cygwin.com. Information about GNU make is
here and you can download a
pre-compiled DOS/Windows version here.
Once you have a make program installed, you can move to the code directory
and type one of the following:
make borland
make g++295
make g++3
make microsoft
make edg
‘g++295’ is for Gnu C++ version 2.95, and ‘g++3’ is for Gnu C++ version 3.0; it is
presumed you are running these compilers under Unix, Linux or
Cygwin (see http://www.Cygwin.com). If you are using a different compiler you can look
at the makefile in the ‘code’ directory to see how to modify it to use your own compiler
by providing the appropriate command-line flags.
The Microsoft Visual C++ compiler, although popular, is a relatively poor
implementation of ISO C++, and so some of the correct C++ files in this solution
guide will not compile with that compiler. You can see which files these are by
looking for the '//{-msc}' tags in the listings and in the document. The
makefiles have been created to exclude those files when you run make microsoft
so the whole process will run to completion without errors.
Please note that this document is not freeware and so cannot be posted,
resold or given away. It is copyrighted and sold only from the site www.BruceEckel.com. You can find copyright
information in the file CopyRight.txt in the root directory of the
unzipped document.