可能重复:
双重比较
int x=-1;
if(0<=x<=9)
        std::cout<< "Without Logical operator";
if (0<=x && x<=9)
    std::cout<< "With Logical operator";
我知道第二个if它工作正常。在第一种if情况下发生了什么。它进入第一个if除了x是-1
为什么编译器error在使用时不给出(0<=x<=9)
可能重复:
双重比较
int x=-1;
if(0<=x<=9)
        std::cout<< "Without Logical operator";
if (0<=x && x<=9)
    std::cout<< "With Logical operator";
我知道第二个if它工作正常。在第一种if情况下发生了什么。它进入第一个if除了x是-1
为什么编译器error在使用时不给出(0<=x<=9)