O'Reilly logo

Sams Teach Yourself C++ in One Hour a Day, Sixth Edition by Bradley Jones, Siddhartha Rao, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Working with Expressions, Statements, and Operators

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.

In this lesson, 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required