O'Reilly logo

C++ for the Impatient by Brian Overland

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 3. Operators

Another concept in C++ that is fundamental to all programs is the concept of expression. Data variables and literals—presented in Chapter 2, “Data”—form the simplest expressions. By using operators, you can build ever-larger expressions out of simpler ones, like an engineer building ever-more sophisticated parts and engines out of smaller ones.

A typical action in C++ is to calculate a value by evaluating a complex expression.

fahrenheit = (centigrade * 1.8) + 32.0;

The items to the right of the equal sign (=) form a complex expression joining centigrade, 1.8, and 32.0 together with the multiply and addition operators (* and +). The results are then assigned to the variable named fahrenheit. Assignment (=) is itself an expression, ...

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