Given a set , find XOR of the XOR 's of all subsets. | C ++ program to find XOR of XOR 's of all subsets ; Returns XOR of all XOR 's of given subset ; XOR is 1 only when n is 1 , else 0 ; Driver program
#include <bits/stdc++.h> NEW_LINE using namespace std ; int findXOR ( int Set [ ] , int n ) { if ( n == 1 ) return Set [ 0 ] ; else return 0 ; } int main ( ) { int Set [ ] = { 1 , 2 , 3 } ; int n = sizeof ( Set ) / sizeof ( Set [ 0 ] ) ; cout << " XOR ▁ of ▁ XOR ' s ▁ of ▁ all ▁ subsets ▁ is ▁ " << findXOR ( Set , n ) ; return 0 ; }