- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
islessgreater() in C/C++
The function islessgreater() is used to check that first argument is less than or greater than the second one. It is declared in “math.h” header file in C language. It returns true, if successful otherwise false.
Here is the syntax of islessgreater() in C++ language,
bool islessgreater(value1 , value2);
Here,
value1 − This is the first argument which will be checked with value2.
value2 − This is the second argument which is used to check value1 and see that is less or greater.
Here is an example of islessgreater() in C++ language,
Example
#include<iostream> #include<math.h> using namespace std; int main() { int val1 = 28; int val2 = 8; bool result; result = islessgreater(val1, val2); cout << "val1 islessgreater than val2 : " << result << endl; return 0; }
Output
Here is the output −
val1 islessgreater than val2 : 1
In the above example, two values are compared and one of them is less or greater than the other. It checks value1>value2 || value1<value2. If one of them ( value1>value2 OR value1<value2 ) is true, it will return 1. Otherwise, it will return 0.
Now, let’s see another example when both values are equal,
Example
#include<iostream> #include<math.h> using namespace std; int main() { int val1 = 8; int val2 = 8; bool result; result = islessgreater(val1, val2); cout << "val1 islessgreater than val2 : " << result << endl; return 0; }
Output
Here is the output −
val1 islessgreater than val2 : 0