Skip to content

Latest commit

 

History

History
96 lines (58 loc) · 1.94 KB

CppOperatorGreaterEqual.md

File metadata and controls

96 lines (58 loc) · 1.94 KB

 

 

 

 

 

 

operator>= is the operator to determine if the left-hand instance is greater or equal the right-hand instance.

 

The following code uses operator>= to determine that one plus two is greater or equal equal to three:

 


#include <iostream> int main() {   if (1 + 2 >= 3) std::cout << "One plus two is greater or equal than three.\n"; }

 

operator>= is encapsulated by the functor std::greater_equal.

 

 

 

 

 

 

 

  • Reversing the order of the pair of symbols in the operators !=, >= and <= (by writing them as =!, => and =< respectively) is normally a syntax error [1]

 

 

 

 

 

 

  1. Paul Deitel, Harvey Deitel. C++11 for programmers (2nd edition). 2014. ISBN: 978-0-13-343985-4. Chapter 2.4, Common Programming Error 2.2. page 32: 'Reversing the order of the pair of symbols in the operators !=, >= and < (by writing them as =!, => and =< respectively) is normally a syntax error. In some cases, writing != as =! will not be a syntax error, but almost certainly will be a logic error that has an effect at execution time.'