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,

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

A note for those of you using Windows: Visual Studio 6 is not a standards-conforming C++ compiler. Instead, try Visual C++ 2010 Express.


10 thoughts on “Accelerated C++ Solutions

  1. Hey dude, you are super! I hope you will update the website with new solutions, I love your style and explanations and a lot of beginners need them to improve. They complete this great book, making everything clear and useful!
    Thank you so much

  2. Perhaps we can get some additional people to contribute to completing the solutions?

    One of the showstoppers for me regarding serious study of a subject is the ability to check my work and further understand a solution.

    Thanks for the 4 chapters you covered here.

  3. Many thanks for this!!! Really nive that other people can post their solution too!
    Hope to see next chapters soon!!! I think that there are some people that could also help and send you code to finish this work sooner and you can mention their names next to each solution.

  4. Thank you so much for taking the time to work through these exercises!
    I appreciate the explanations given; they really clear up any confusion I had and help reinforce
    the important concepts. Can’t wait until you’ve got solutions for every exercise! Keep up the
    good work!

  5. Thanks for doing the solutions for Chapters 1-4 so far! I really appreciate being able to see what I did wrong and why; a number of these I was convinced I was correct on, but in fact was not. It was nice to have a way to catch those mistakes.

  6. Hey dude,
    Thanks a ton! It really motivates people to work through chapters, when you can refer back to a solution. Looking forward to solutions to more chapters! :)

Leave a Reply

Your email address will not be published.