There is no ternary (or 'chained') >
operator in C or C++. Thus your expression evaluates to ((a>b)>c)
as evaluation is done left to right.
In C, true expressions evaluate to 1
, and false ones to 0
. In C++ my recollection is that they evaluate to boolean true
or false
, but then these type convert to 1
or 0
anyway, so the situation is much the same.
Using that principle, a>b
will evaluate to 1
if a>b
and to 0
otherwise. Therefore if a>b
, the entire expression evaluates to 1>c
, else to 0>c
. As c
is more than one, neither 1>c
nor 0>c
are true, and the output is always 0
, or false, and the program will print False
.
To achieve what I strongly suspect you really want, use ((a>b) && (b>c))
.