O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by 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

Relational Operators

What exactly is the relationship between these “not” and “or” operators? Is there an “and” operator, and is it useful here? Isn't this excessively complex? Not if you approach it carefully.

First, let's recap the simple bool expression in a little more detail. Remember that a bool expression can be true or false. There are six bool relational operators, used to compare values. Like +, they are infix operators, so they have an operand to the left and an operand to the right. Table 10.1 shows their names, symbols, examples of their use, and the example values.

Table 10.1. The Relational Operators
Name Operator Sample Value
Equal to == 100 == 50; 50 == 50; false true
Not equal to != 100 != 50; 50 != 50; true false
Greater than ...

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