Skip to content

Commit

Permalink
Update Bitset
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashishgup1 authored Jun 22, 2020
1 parent e20731a commit 8ee527c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Bitset
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
const int SZ = 2001;

void functions()
{
bitset<SZ> bit;
bit.all(); //checks whether all bits are set or not
bit.any(); //checks whether >= 1 bit is on
bit.none(); //checks if all bits are off
bit.count(); //counts no of set bits
bit.flip(); //flips all bits
bit.flip(1); //flips 1st bit
bit.reset(); //resets all bits to 0
bit.reset(1); //resets 1st bit
bit.set(); //sets all bits to 1
bit.set(1); //sets 1st bit to 1
bit.size(); //return size of bitset
bit.test(1); //check if 1st bit is on or not
cout << bit.to_string(); //converts to string
}

//Problem 1 (DP): https://www.spoj.com/problems/ADACOINS/

Expand Down

0 comments on commit 8ee527c

Please sign in to comment.