bool bitset<N>::reference::operator bool();
#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> : "<< qBits << endl; // Output each converted boolean value cout << "qBits[0] = "<< (bool)(qBits[0]) << endl; cout << "qBits[1] = "<< (bool)(qBits[1]) << endl; cout << "qBits[2] = "<< (bool)(qBits[2]) << endl; cout << "qBits[3] = "<< (bool)(qBits[3]) << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.