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. There will also be some assistance by Email (send questions to firstname.lastname@example.org) and (by arrangement) telephone.
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.
The practical classes are intended for you to show problems that you have, and ask for help on how to resolve them. They are not long enough to actually do the drills and exercises needed to learn C++.
This is published by Addison-Wesley, and the latest printing (2009) is ISBN 978-0321543721. You will also need a copy of the errata. A locally merged copy of all three sets of errata, suitable for use with the first printing, is here in HTML and PDF.
If you do not have this level of skill, you will have trouble even getting started.
The Microsoft Office suite is NOT suitable, because it is very hard to prevent it inserting formatting markup (‘rich text’). The lecturer finds the editor packaged with Microsoft Visual Studio very painful to use, but you may find it acceptable.
lEarning another programminglanguage would also do. “Programmer” does not mean in Visual Basic, Excel or even most uses of Matlab; it means in Python, Fortran, C, Pascal etc. It surprises most people, but learning simpler languages first often saves time overall.
There is a fair amount more that you will need, but not until you reach chapter 12.
Some courses are like that, and they teach you enough to get yourself into trouble, but not enough to avoid the trouble or get yourself out of it. When you write real programs, you end up wasting more time than learning the language properly, often because you have to ‘unlearn’ much of what you learnt.
Some other courses are like that, and you learn a language that has all the disadvantages of C. When you write real programs, you waste time using ineffective methods and (worse) in unnecessary debugging. C was designed for use as a semi-portable assembler, not as a high-level language.
It does not assume that you know C (in fact doing so could be a disadvantage). Also, it does not assume that you know computational theory, and does not teach how a C++ compiler is likely to work. It does teach how the library is likely to be implemented, because you will be writing your own classes.
With a few exceptions, it teaches programming techniques and C++ constructs that are portable and reliable. These should work on any system, even 20 years from now. Indeed, most of its methodology is applicable to other comparable languages, like Python and modern Fortran.
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++.
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.
6th and 7th sessions:
8th and 9th sessions:
11th session (actually 12th in 2013):
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.