English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This functionisgreaterequal()
is used to check if the first parameter is greater than or equal to the second parameter. Declared in the C language 'math.h' header file. Returns true on success, otherwise returns false.
This isislessgreater()
C ++Language syntax,
bool isgreaterequal(value1 , value2);
Here,
value1-This is the first parameter, which will be compared with value2are checked together.
value2-This is the second parameter, used to check if value1greater than or equal.
This isisgreaterequal()
C ++Language example,
#include<iostream> #include<math.h> using namespace std; int main() { int val1 = 28; int val2 = 8; bool result; result = isgreaterequal(val1, val2); cout << "val1 is greater than or equal to val2 : " << result << endl; return 0; }
Output result
val1 is greater than or equal to val2 : 1
In the above example, two values were compared, one of which is less than or greater than the other. It checks if value1> value2 || value1 = value2. If one of them (value1> value2 OR value1 = value2)is true, then it will return1. Otherwise, it will return 0.
Now, let's look at another example, when the first value is less than the second value,
#include<iostream> #include<math.h> using namespace std; int main() { int val1 = 5; int val2 = 8; bool result; result = isgreaterequal(val1, val2); cout << "val1 is greater than or equal to val2 : " << result << endl; return 0; }
This is the output,
Output result
val1 is greater than or equal to val2 : 0