You are viewing a single comment's thread. Return to all comments →
long flippingBits(long n) { string binary = bitset<32>(n).to_string(); int l = binary.size(); for(int i=0; i<l; i++) { if(binary[i] == '0') binary[i] = '1'; else binary[i] = '0'; } long decimal = bitset<32>(binary).to_ulong(); return decimal; }
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping bits
You are viewing a single comment's thread. Return to all comments →