bitset<N>::reference& bitset<N>::reference::flip();
#include <bitset>
#include <bitset> #include <iostream> int main() { using namespace std; // Create a bitset of four bits with the 2nd one "on" bitset<4> qBits(2); cout << "bitset<4> before flip : "<< qBits << endl; // Flip the bit at index 3--start at 0 on the right qBits[3].flip(); cout << "bitset<4> after flip : "<< qBits << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.