C++ Programming Code Examples C++ > Beginners Lab Assignments Code Examples Relational Operators in C++ programming Relational Operators in C++ programming This category of the operators is used to compare different values. The result of the operation is a Boolean value (true or false). The relational operators are used in the following form Operand1 operator Operand2, where operands can be some variables or literals that are compared. Here is the list of relational operators: operator description == Equal to Returns true if the operands are equal. Otherwise false. != Not equal to Returns true if the operands are not equal. Otherwise false. < Less than Returns true if the operand1 is less than operand2. Otherwise false. > Greater than Returns true if the operand1 is greater than operand2. Otherwise false. <= Less than or equal to Returns true if the operand1 is less than operand2 or equal to operand 2. Otherwise false. >= Greater than or equal to Returns true if the operand1 is greater than operand2 or equal to operand 2. Otherwise false. int three = 3; int five = 5; cout << " 3 is equal to 5 = " << (three == five) << endl; cout << " 3 is not equal to 5 = " << (three != five) << endl; cout << " 3 is less than 5 = " << (three < five) << endl; cout << " 3 is greater than 5 = " << (three > five) << endl; cout << " 3 is not less than 5 = " << (three >= five) << endl; cout << " 3 is not greater than 5 = " << (three <= five) << endl;