Logical XOR operator in C++?

后端 未结 11 1295
轮回少年
轮回少年 2020-11-29 15:54

Is there such a thing? It is the first time I encountered a practical need for it, but I don\'t see one listed in Stroustrup. I intend to write:

// Detect wh         


        
11条回答
  •  广开言路
    2020-11-29 15:57

    I use "xor" (it seems it's a keyword; in Code::Blocks at least it gets bold) just as you can use "and" instead of && and "or" instead of ||.

    if (first xor second)...
    

    Yes, it is bitwise. Sorry.

提交回复
热议问题