isgreater() in C/C++

CC++Server Side Programming

The function isgreater() is used to check that the first argument is greater than the second one or not. It is declared in “math.h” header file in C language. It returns true, if successful, otherwise false.

Here is the syntax of isgreater().

bool isgreater(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 that is greater or not.

Here is an example of isgreater().

Example

 Live Demo

#include<iostream>
#include<math.h>
using namespace std;
int main() {
   int val1 = 28;
   int val2 = 8;
   bool result;
   result = isgreater(val1, val2);
   cout << "val1 is greater than val2 : " << result << endl;
   return 0;
}

Output

val1 is greater than val2 : 1

In the above program, the functionality of function isgreater() exists in main() function. Three variables are declared as val1, val2 and result. The function is checking that the first value val1 is greater than second value val2 or not. Which is stored in variable result.

result = isgreater(val1, val2);
raja
Published on 05-Nov-2018 11:28:13
Advertisements