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 provide those solutions.
So far there are solutions available through part of chapter 4, and I’ll add solutions as I get the time. If you have any questions, suggestions, or comments, or if you find any errors, let me know.
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. When I have time, or where appropriate, I may provide more than one solution to an exercise.
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/.
I am currently working from the fourth printing of the book. When I get a newer revision I’ll go back and update the exercises with any changes.
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 https://stroustrup.com/compilers.html.