By 25/02/2014 16 Comments

Relational and Equality Operators ( ==, !=, >, <, >=, <= ) in C++

In order to evaluate a comparison between two expressions we can use the relational and equality operators. The result of a relational operation is a Boolean value that can only be true or false, according to its Boolean result. We may want to compare two expressions, for example, to know if they are equal or if one is greater than the other is. Here is a list of the relational and equality operators that can be used in C++:

  • Equal to (==)

  • Not Equal to (!=)

  • Greater than (>)

  • Less than (<)

  • Greater than or Equal to (>=)

  • Less than or Equal to (<=)

Suppose that x=2, y=3 and z=6

(x == 5)	// evaluates to false since x is not equal to 5. 
(x*y >= z)	// evaluates to true since (2*3 >= 6) is true. 
(y+4 > x*z) // evaluates to false since (3+4 > 2*6) is false. 
((y=2) == x) // evaluates to true.






Posted in: C++ Basics

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .