Intro to C++

Why teach C++

We want to teach you how a computer's hardware really works. Knowing a lower level language like C++ will make you a more capable developer than one who only knows Python or Java. The blog post You Can't Dig Upwards explains why.


Before you begin, install the tools listed here, including Git.

Once the development environment is set up, one may begin learning C++. We use the textbook Programming: Principles and Practice Using C++ (2nd edition) by Bjarne Stroustrup (ISBN: 978-0-321-99278-9). Either a copy will be provided by the software team or a copy can be bought directly from the publisher. The current textbook errata are here.


Chapter 2 of the book requires std_lib_facilities.h. Useful resources for the C++ standard library include

In addition to the following exercises, we recommend you do all the drills at the end of each chapter, although it is not required. See section 0.1.2 in the textbook for the reasoning behind this and section 0.1.1 for the textbook's general approach. The review questions are good for checking comprehension, but they aren't exhaustive, so still read carefully.

We recommend covering at least one chapter per week. There may not be enough time to lecture on all the material in depth in a given week, so individual reading is encouraged. The book is designed for this situation.

Provide answers to any essay questions in a README file. Don't forget to read the postscript at the end of each chapter. They provide useful insights.

Chapter 2 - Hello, World!

p. 52: Drill

p. 55: Exercises 1-4

Chapter 3 - Objects, Types, and Values

p. 83: Drill

p. 85: Exercises 2-5, 9-11

Chapter 4 - Computation

p. 126: Drill

p. 128: Exercises 8, 11, 13, 15, 19-21

Chapter 5 - Errors

p. 167: Drill

p. 169: Exercises 2-5, 7, 8-10

p. 169: Optional 12, 13

For exercise 2, provide a working implementation with comments describing how each part was fixed.

Chapter 6 - Writing a Program

p. 217: Drill

p. 218: Exercises 4-6

Chapter 7 - Completing a Program

Just read the chapter.

Chapter 8 - Technicalities: Functions, etc.

Just read the chapter.

Chapter 9 - Technicalities: Classes, etc.

Just read the chapter.


Students wanting to cover more advanced topics of the C++ programming language should read chapters 17-21 from Part III in order. They cover data structures, algorithms, memory management, and templates.


See the CI submission instructions.

For files which are modified between assigned problems, there should still be a separate project for each problem. For example, chapter 4's exercises 19 through 21 will have a separate project each for exercise19, exercise20, and exercise21. Copy-pasting the previous project's files may make this easier.