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