Write a c++ value returning function that receives two floating point numbers and returns true if the first formal parameter is greater than the second.
Answers
Others have already shown that you (may) want a function that boils down to
return (first>second)
But there are some things being glossed over:
It is entirely possible that first and second cannot be order (e.g. if at least one is Not a Number) In which case the comparison is meaningless.
C does not have a specific value “true”. In fact, rookie programmers who “fix” this by something like
#define TRUE (1)
and pepper the code with
if ( some_function(a,b) == TRUE)
have been a fertile source of bugs for probably as long as C has existed, since the language definition is only that any non-zero value is interpreted as true for the purpose of tests. Even worse would be #defining TRUE as all-ones, because then even the builtin logical operators (which evaluate to 1 or 0) would not compare as TRUE.