Day 4. Creating Expressions and Statements

At its heart, a program is a set of commands executed in sequence. The power in a program comes from its capability to execute one or another set of commands, based on whether a particular condition is true or false.

Today, you will learn

• What statements are

• What blocks are

• What expressions are

• How to branch your code based on conditions

• What truth is, and how to act on it

Starting with Statements

In C++, a statement controls the sequence of execution, evaluates an expression, or does nothing (the null statement). All C++ statements end with a semicolon and nothing else. One of the most common statements is the following assignment statement:

x = a + b;

Unlike in algebra, this statement ...

Get Sams Teach Yourself C++ in 21 Days , Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.