Accelerated C++ Solutions

I often recommend the book Accelerated C++, by Andrew Koenig and Barbara E. Moo, to people who are just beginning to learn the C++ language. While it is an excellent tutorial and a novel approach to learning C++, one complaint I often hear is that there are no solutions provided for the exercises. This page exists to remedy that problem.

I'll add solutions as I get the time. If you have any questions or comments, or if you find any errors, let me know.

Status of the Solutions

I first started this project a couple of years ago (around 2003), and then I promptly got sidetracked by a number of things. I'm now back on this project and I'll be there until it's finished. This time, however, I have help. One of the operators of the Undernet IRC C++ channel, Victor A. Wagner, will also be working on the solutions and keeping me on task.

How Far We've Gotten

So far there are solutions available through chapter 2.

About the Solutions

For each exercise there is a hint and at least one solution given. These are hidden by default and may be shown by clicking on the appropriate link. The solutions are intended to be the simplest and most straightforward for the problem at hand. Each applies material that the reader has covered. There is almost certainly more than one way to solve each problem so the solutions you find here aren't the only correct answers, just the most appropriate in the opinion of the author. The reader is encouraged to try alternative solutions.

The issue of code formatting is an ongoing "religious" debate among C++ developers, and will never be resolved. The code provided in the solutions follows the same general formatting style used in the original book. Some of the exercises alter this formatting somewhat as part of the problem; the solutions to these exercises will use the same altered formatting when providing modifications or corrections to the exercise source.

The first exercise in each chapter instructs the reader to compile and execute the programs presented in the chapter. Except for chapter 0, no solutions are provided for these exercises. The source code for the programs in the book may be downloaded from the book's web site, http://www.acceleratedcpp.com/.

Getting a Compiler

In order to complete the exercises in the book the reader will need a standards-conforming C++ compiler. A list of compilers, both free and commercial, may be found at http://www.research.att.com/~bs/compilers.html.

The Exercises, By Chapter