Lesson 5. Working with Expressions, Statements, and Operators
At its heart, a program is a set of commands executed in sequence. These commands are programmed into expressions and statements and use operators to perform specific calculations or actions.
In this lesson, you learn
• What statements are
• What blocks or compound statements are
• What operators are
• How to perform simple arithmetic and logical operations
Statements
Languages—spoken or programmed—are composed of statements that are executed one after another. Let’s analyze the first important statement you learned:
cout << "Hello World" << endl;
A statement using cout
displays text using the console on the screen. All statements in C++ end with a semicolon (;
), which defines the ...
Get Sams Teach Yourself C++ in One Hour a Day, Seventh 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.