bool bitset<N>::any() const;
#include <bitset>
#include <bitset> #include <iostream> int main() { using namespace std; // Create two bitsets bitset<4> qBits1(0); bitset<4> qBits2(12); cout << "bitset<4> #1 : "<< qBits1 << endl; cout << "bitset<4> #2 : "<< qBits2 << endl; // Call the any() function to test the bitsets. cout << (qBits1.any() ? "Some" : "None") << " of the bits of bitset<4> #1 are 1." << endl; cout << (qBits2.any() ? "Some" : "None") << " of the bits of bitset<4> #2 are 1." << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.