Relational operator of C++

Additional relational operators:

Operator                 Description               Example

  ==                      Equal to                 4==2 False
  <=                Less than or equal to          4<=2 False
  >=               Greater than or equal to        4>=2 True
  !=                     Not equal to              4!=2 True

Example:

if(10==10)
{
  cout<<"Yes";
}

Output:

Yes

The not equal to operator evaluates the operands, determines whether or not they are equal. If the operands are not equal, the condition is evaluated to true.
For example:

if(10!=10)
{
  cout<<"Yes";
}
else
{
  cout<<"No";

Output:

No

You can use relational operators to compare variables in the if statement.
For example:

int a=55;
int b=33;
if(a>b)
{
  cout<<"a is greater than b";
}

Outputs:

a is greater than b


Related Article