topical media & game development

talk show tell print

professional-program-21-BitsetBasics-BitsetBasics.c

? / professional-program-21-BitsetBasics-BitsetBasics.c


  include <bitset>
  include <iostream>
  using namespace std;
  
  int main(int argc, char** argv)
  {
    bitset<10> myBitset;
  
    myBitset.set(3);
    myBitset.set(6);
    myBitset[8] = true;
    myBitset[9] = myBitset[3];
  
    if (myBitset.test(3)) {
      cout << "Bit 3 is set!\n";
    }
    cout << myBitset << endl;
  
    return (0);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.