Or and not equal

前端 未结 6 805
忘掉有多难
忘掉有多难 2021-01-24 20:23

Why does this work?

#include 
#include 
using namespace std;
int main(){
string s=\"a\";
if((s==\"cm\")||(s==\"in\")||(s==\"ft\")||         


        
6条回答
  •  不要未来只要你来
    2021-01-24 21:05

    You're trying to check whether it's unequal to all of those strings, not whether it's unequal to any of those strings.

    Use and, not or.

提交回复
热议问题