- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Relational Operators in C++
In C++ Programming, the values stored in two variables can be compared using following operators and relation between them can be determined. These operators are called relational operators. Various C++ relational operators available are −
Operator | Description |
---|---|
> | Greater than |
>= | Greater than or equal to |
== | Is equal to |
!= | Is not equal to |
< | Less than |
You can use these operators for checking the relationship between the operands. These operators are mostly used in conditional statements and loops to find a relation between 2 operands and act accordingly. For example,
Example
#include<iostream> using namespace std; int main() { int a = 3, b = 2; if(a < b) { cout<< a << " is less than " << b; } else if(a > b) { cout<< a << " is greater than " << b; } else if(a == b){ cout << a << " is equal to " << b; } return 0; }
Output
This will give the output −
3 is greater than 2

Advertisements