Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Logical (not bitwise) XOR in C++
#include <iostream>
int main() {
int a = 1; int b = 2;
if ((bool)a != (bool)b)
std::cout << "a xor b -> true" << std::endl;
else
std::cout << "a xor b -> false" << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment