Chapter 1. C++ Basics

“To my children: Never make fun of having to help me with computer stuff. I taught you how to use a spoon.”

—Sue Fitzmaurice

In this first chapter, we will guide you through the fundamental features of C++. As for the entire book, we will look at it from different angles but we will not try to expose every possible detail—which is not feasible anyway. For more detailed questions on specific features, we recommend the online manuals and

1.1 Our First Program

As an introduction to the C++ language, let us look at the following example:

#include <iostream>int main (){    std::cout "The answer to the Ultimate Question of Life,\n"               ...

Get Discovering Modern C++: An Intensive Course for Scientists, Engineers, and Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.