Bitset 'and', and shift operators : bitset and or « bitset « C++ Tutorial






#include <bitset>
#include <iostream>
using namespace std;

int main(int argc, char** argv)
{
  string str1 = "0011001100";
  string str2 = "0000111100";
  bitset<10> bitsOne(str1), bitsTwo(str2);

  bitset<10> bitsThree = bitsOne & bitsTwo;
  cout << bitsThree << endl;
  bitsThree <<= 4;
  cout << bitsThree << endl;

  return (0);
}








18.3.bitset and or
18.3.1.Result of XOR between the two sequences
18.3.2.Result of OR between the two sequences
18.3.3.Bitset 'and', and shift operators
18.3.4.Result of AND between the two sequences
18.3.5.Or fields in bitset