Find XOR of two number without using XOR operator | C ++ program to find XOR without using ^ ; Returns XOR of x and y ; Driver program to test above function
#include <iostream> NEW_LINE using namespace std ; int myXOR ( int x , int y ) { return ( x & ( ~ y ) ) | ( ( ~ x ) & y ) ; } int main ( ) { int x = 3 , y = 5 ; cout << " XOR ▁ is ▁ " << myXOR ( x , y ) ; return 0 ; }