Why does this work?
#include #include using namespace std; int main(){ string s=\"a\"; if((s==\"cm\")||(s==\"in\")||(s==\"ft\")||
In your second case s != "cm" and of course the first cout is printed. To negate the check and the logic to remain the same, do it like this:
s != "cm"
cout
if((s!="cm")&&(s!="in")&&(s!="ft")&&(s!="m")) cout<<"I like "+s; else cout<