Hi there,
I am working on a project that requires me to compare two numbers. Is there a quick function like int r = a.compare(b) that returns -1 if the number is less than, 0 if its the same and +1 if it is greater?
Thanks,
Gav
r = std::min(1, std::max(-1, b-a));
r has a value of -1 if b is less than a.
r has a value of 0 if b is equal to a.
r has a value of 1 if b is greator than a.