    #include <iostream>
    #include <iomanip>
    #include <bitset>
    #include <limits>
    
    void flipBits(unsigned long value) {
    	std::bitset<std::numeric_limits<unsigned long>::digits> bits(value);
        std::cout << "Original value : 0x" << std::hex << value;
    
        value = bits.flip().to_ulong();
        std::cout << ", Value after flip: 0x" << std::hex << value << std::endl;
    }
    
    int main() {
        flipBits(0x12345678);
        flipBits(0x11223344);
        flipBits(0xabcdef12);
        flipBits(15);
        flipBits(0xffffffff);
        flipBits(0x0);
        return 0;
    }
