Hour 4. Using Expressions, Statements, and Operators

Statements

All C++ programs are made up of statements, which are commands that end with a semicolon. Each statement takes up one line by convention, but this is not a requirement—multiple statements could be put on a line as long as each ends with a semicolon. A statement controls the program’s sequence of execution, evaluates an expression, or can even do nothing (the null statement). A common statement is an assignment:

x = a + b;

This statement assigns the variable x to equal the sum of a + b. The assignment operator ...

Get Sams Teach Yourself C++ in 24 Hours, fifth edition 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.