Relational Expressions
Computers are more than relentless number crunchers. They have the capability to compare values, and this capability is the foundation of computer decision making. In C++ relational operators embody this ability. C++ provides six relational operators to compare numbers. Because characters are represented by their ASCII codes, you can use these operators with characters, too. They don’t work with C-style strings, but they do work with string
class objects. Each relational expression reduces to the bool
value true
if the comparison is true and to the bool
value false
if the comparison is false, so these operators are well suited for use in a loop test expression. (Older implementations evaluate true relational expressions ...
Get C++ Primer Plus 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.