

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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
- Related Questions & Answers
- Java Relational Operators
- Relational Set Operators in DBMS
- Basic Operators in Relational Algebra
- Relational Operators in Dart Programming
- C++ Relational and Equality Operators
- Relational and comparison operators in C++
- What are relational operators in C#?
- Relational and Logical Operators in C
- Extended Operators in Relational Algebra in C++
- What are the relational operators in Java?
- Relational Operators on STL Array in C++
- What are relational operators in C language?
- Comparing String objects using Relational Operators in C++
- Find maximum in an array without using Relational Operators in C++
- Find minimum in an array without using Relational Operators in C++
Advertisements