我在If语句y<>3
看到了这个示例,我想知道它的作用。
I have to check if this exercise is correct
It is not.
if (((x < y) && (y < z)) && (y != 3))
printf(“%f < %d < %d \n”, x, y, z);
Is correct, assuming float x
and int y, z
.
<>
in some languages means "does not equal". But in c, the operator is !=
. Also note the difference between logical AND ( &&
) and bitwise AND ( &
). You should use the logical operators for multiple criteria in a conditional statement.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.