This site contains an original, self-contained guide to learning the fundamentals of Modern C++, intended to be the basis of a self-study course. Some Chapters depend upon material presented in earlier ones, so studying them linearly is recommended. There are also regular posts (accessible from the front page) which cover topics or areas of C++ not covered in the course.
If you have any queries or suggestions, please leave a comment. The course materials are in a completed state (updated to cover parts of C++23) and are made freely available here as well as being hosted on GitHub:
- About this Tutorial
- String and Character Literals
- Variables, Scopes and Namespaces
- Conditions and Operators
- Functions
- Arrays, Pointers and Loops
- Enums and Structs
- Strings, Containers and Views
- Files and Formatting
- Classes, Friends and Polymorphism
- Templates, Exceptions, Lambdas, Smart Pointers
- Download the code examples (as a zipfile) or browse them on GitHub.
- View details (as a sitemap) of the course topics.
- Suggested coding assignments for each Chapter.
- New! Download the whole Tutorial as a set of interactive Jupyter notebooks (as a zipfile), intended for use with self-hosted JupyterLab.
Last update: 2025/11/24 – update to Chapter 2, and usage guide in the notebooks download
I found that the code you provide can not be compiled
LikeLike
Hi,
Sorry to hear you’re having difficulties. Please could you go into more detail about which code sample and which compiler/options you are using? Would like to resolve this for you, thanks.
LikeLike
Thank you very much for your great tutorials! I found them to be very helpful.
I have learned C and a bit of C++ more than 15 years ago but from 10 years ago I have been mostly a python programmer. Recently I wanted to learn the “modern” version of C++ again and have worked through all your 10 chapters. I think your tutorials provide an excellent overview of “modern” C++ features and allow me to get quickly up to speed π
LikeLike
Hi,
Thanks so much for the feedback! I do keep an eye on the stats and traffic is increasing all of the time, however it’s great to hear that the tutorial has really been useful to someone. Also, well done for getting through all ten chapters!
LikeLike
Isn’t the most “modern” way to write to the console:
std::println(“Hello World!”);
LikeLike
Yes, you are correct. C++23 changes the “Hello World” program to use std::format instead of iostream.
Updating this part of the Tutorial would mean major changes to the chapter “Files and Formatting” were needed too. Due to interest in the site I would like to keep it up-to-date, so these changes are on my to-do list for 2024, pending widespread compiler/library support.
LikeLike
Thank you for this very well written tutorial! Working through the examples and playing with them according to your suggestions was extremely instructional! I appreciate the effort you put in to these pages and can recommend this tutorial to everyone interested in modern C++.
LikeLike