The Basics of C++

In this unit we will discuss the most basic features of C++, those we need to use to write any sort of interesting program.

But before we write interesting programs, we have to be able to write, compile, and run any program at all. (Compiling a program is turning human-readable source code into runnable machine code. A language like Python does this when you run the Python source code: it compiles and runs in one step, which is characteristic of interpreted languages. C++ divides this into two separate steps, which is more laborious, but which also makes the resulting program run significantly faster.) And that can involve a fair bit of setup and installation work. So the very first thing you should do, with whatever C++ development tool you use, is to try to compile and run Hello World!, the standard first program to try in any language.

Once you have gotten "Hello World!" to run, you next need to master these C++ basics:

Here are some code examples to help you: