[ create a new paste ] login | about

Link: http://codepad.org/YlO2Ac6m    [ raw code | output | fork ]

C++, pasted on Nov 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
#include <bitset>
using namespace  std;

int main()
{
bitset<32> a(string("10111"));
bitset<32> b(string("00111"));
bitset<32> c(string("10101"));

bitset<32> mask(string("111"));

cout<< boolalpha << ( (a&mask) == (b&mask) ) <<endl;
cout<< boolalpha << ( (a&mask) == (c&mask) ) <<endl;

return 0; 
}


Output:
1
2
true
false


Create a new paste based on this one


Comments: