Bitset Bitwise Operations

Revision en1, by Mohsina_Shaikh, 2022-08-21 12:30:32
#include <bits/stdc++.h>

using namespace std;

int main()
{
    bitset<8> bt(3);
    bt[1]|=1;
    cout<<bt[1]<<"\n";
    return 0;
}

The program throws error. Why cannot we perform bitwise operations on bitsets like this.can anyone please explain.

Tags bitset, bitwise, c++, help me

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Mohsina_Shaikh 2022-08-21 12:30:32 296 Initial revision (published)