#include#include int main() { std::bitset<8> bits("01100110"); std::cout << bits << std::endl; bits.reset(); std::cout << bits << std::endl; return 0; }
#includeThis code initializes a bitset of size 16 with all bits set to 0 and then prints the bitset. The set function is then called to set the 4th bit to 1 and the bitset is printed again. The reset function is then called to set all bits to 0 and the bitset is printed again. The bitset class is part of the C++ Standard Library.#include int main() { std::bitset<16> bits; std::cout << bits << std::endl; bits.set(4); std::cout << bits << std::endl; bits.reset(); std::cout << bits << std::endl; return 0; }