Simple Relational Operator Example Program In C++
Relational Operators
- It compares two operands and depending on their relationship.
Syntax
Op1 Operator Op2
Example :
a > b
There are six relational operators. They are,
- < less than
- > greater than
- <= less than or equal to
- >= greater than or equal to
- == equal to
- != not equal to
Example of Relational Operator Program
// Header Files
#include<iostream>
#include<conio.h>
//Main Function
using namespace std;
int main ()
{
// Variable Declaration
int a = 25, b = 5;
//int a = 5, b = 25;
//int a = 5, b = 5;
cout << "Simple Relational Operator Example Program \n";
if( a>b )
cout<<"A is Big";
else if( a== b)
cout<<"A and B are Equal";
else
cout<<"B is Big";
// Wait For Output Screen
getch();
//Main Function return Statement
return 0;
}
Sample Output
Simple Relational Operator Example Program
//if a = 25, b = 5;
A is Big
//if a = 5, b = 25;
B is Big
//if a = 5, b = 5;
B is Big
C++ Operator Example Programs
- Simple Arithmetic Operators Example Program In C++
- Simple Relational Operator Example Program In C++
- Simple Logical Operators Example Program In C++
- Simple Assignment Operators Example Program In C++
- Simple Unary Operators Example Program In C++
- Simple Conditional or Ternary Operators Example Program In C++
- Simple Comma Operators Example Program In C++
- Simple Scope Resolution Operator Example Program In C++
- Simple new Memory Allocation Operator Example Program In C++
- Simple delete Memory Releasing Operator Example Program In C++
Read More Articles
- Simple Merge Sort Program in C++
- Scope Resolution Operator In C++
- Simple Program for Virtual Functions Using C++ Programming
- Simple Class Example Program For Find Prime Number In C++
- Simple Example Program For Parameterized Constructor In C++
- Define Constructor in Outside Class Example Program In C++
- Simple Example Program For Copy Constructor In C++
- Simple Program for Function Overloading Using C++ Programming
- Simple Program for Single Inheritance Using C++ Programming
- Simple Program for Inline Function without Class Using C++ Programming
- Simple Example Program For Constructor Overloading In C++
- Factorial Using Function Example Program In C++
- Simple Example Program for Inline Function Using C++ Programming
- Simple Addition ( Add Two Integers ) Example Program
- Simple Example Program For Constructor In C++
- Simple Program for Read user Input Using cin
- Simple Stack Program in C++ Programming
- Factorial Using Loop Example Program In C++
- Simple Program for Friend Function Using C++ Programming
- Simple Program for Static Data and Member Function Using C++ Programming
- Simple Program for Multiple Inheritance Using C++ Programming
- Simple Program for Unary Operator Overloading Using C++ Programming
- Simple Copy Constructor Example Program For Find Factorial In C++
- Do While Loop Example Program In C++
- Simple Program for Virtual Base Class Using C++ Programming