以下程序的输出是“不相等”,但是我希望“他们是平等的”三个变量相比(x,y,和z)相等。为什么?
#include <iostream>
int main()
{
int y, x, z;
y = 3;
x = 3;
z = 3;
if (x == y == z)
{
std::cout << "they are equal\n";
}
else
{
std::cout << "they are not equal\n";
}
}
Run Code Online (Sandbox Code Playgroud) c++ ×1