Comparing 3 values.

Gin319:
thanks for your replies!

im a bit confused. the "max" command worked, but how could i return the variable with the largest value? for example:

x = 1;
y = 3;
z = 4;

since z is the greatest reading, then it would do a certain action.

Should have posted last night - I thought it strange to want the max value of 3 axes but not know which one.

There's a host of ways of doing it, but psuedo code can look like this:

if (x_is_biggest(x, y, z)) {
    // do something for x
}
else if (y_is_biggest(x, y, z)) {
    // do something for  y
}
else if (z_is_biggest(x, y, z)) {
    // do something for z
}

keeping in mind you will need to test edge cases for scenarios like x == y == z and combinations thereof.

your *_is_biggest functions will look like

bool (x_is_biggest(int x, int y, int z)) {
    return ((x > y) && (x > z));
}