Programming in Modern C++

IMPORTANT: This course is largely copyright Prof. Bjarne Stroustrup, Texas A&M University, and its presence here does NOT constitute permission to copy it for any reason or use other than attending the course or for personal study using it. If you want to take a copy for any other reason, please go to the Web page of the base course, and use those pages in accordance with their (liberal) conditions. You may, of course, refer to these pages to see what they contain.

This is an introduction to programming in modern C++, based on the book Programming: Principles and Practice using C++. It teaches how to write modern C++ as the designer intended it to be used, and that is the key to effective use of the C++ language. It teaches several aspects of programming and C++ that are neglected in many courses, like practical program design and some numerical programming. There is some extra, locally written, material on those topics. The aim is to teach you how to write large, practical programs.

Prof. Stroustrup estimates that newcomers to programming will have to put in about 210 hours' of work to learn how to program in C++ properly. Yes, that is right: five weeks' solid work. That is an accurate estimate; this is not an easy course and should not be undertaken lightly. Unfortunately, the effort is due to the nature of the C++ language, and not the way the course is presented. We are attempting to give this course in rather less time by targetting people who have some of the basic skills.

This why we say that complete newcomers to programming should learn to use Python first, and why this course is spread over most of a year. A lecture will be given every fortnight, and a practical class once a month, which gives you time to read the book and do the exercises in between lectures..


You do not have to use Linux to attend this course but, if not, you may need to be able to install a C++ compiler and the course materials yourself, and use them to build C++ programs. See below for possible options. What little help can be given on installing materials and using the systems will be for Linux and very similar Unices only. Also, the MCS systems used for the practical classes run only Linux or Microsoft Windows, and the latter have only Visual Studio 2005.

There is a fair amount more that you will need, but not until you reach chapter 12.

What this course is not

The Lecture Slides as modified for use at Cambridge

The first lecture is mainly local material, but the remainder are those from the book's support site with some local additions. People doing the course at Cambridge need to look at these, because they include important local information that is not in the book. Each set of slides except the first corresponds to a book chapter, but not all chapters are used.

The first session of the course is intended only, to get you started. If you have difficulty with this, you may prefer to back off and go to some other courses first. We recommend Python as a first language, but Matlab or R will be more suitable for some people; there is also a 3-day Fortran course later in the term. You can learn to use any of these (even Fortran) to a comparable level in about 20% of the time that you will need to learn C++.

First session:

Even if you know this much C++, you should make sure that you can use the course materials, and ask for help at this point if you have trouble.

Lectures will be given approximately every two weeks, and each will be followed by a practical class. This should give you enough time to try the drills and exercises, so you can ask questions at the next practical class.

2nd session:

3rd session:

4th session:

5th session:

6th and 7th sessions:

8th and 9th sessions:

10th session:

11th session (actually 12th in 2013):

Auxiliary Material

Material from the book's support site has been copied only when changes have been made. There is a lot of material there that could be very useful, and you are recommended to look at it.

Sources of the materials used to run the course at Cambridge, including the graphics libraries.

Locally written Drill and Exercise Code.