2.6. Decision Making: Equality and Relational Operators
We now introduce a simple version of C++’s if statement that allows a program to take alternative action based on whether a condition is true or false. If the condition is true, the statement in the body of the
if statement is executed. If the condition is false, the body statement is not executed. We’ll see an example shortly.
if statements can be formed by using the relational operators and equality operators summarized in Fig. 2.9. The relational operators all have the same level of precedence and associate left to right. The equality operators both have the same level of precedence, which is lower than that of the relational operators, and associate left to right.