I am trying to store 0 to 25 numbers along with its 5 bit representation using bitset.
Here is the code :
int main()
{
map<int, bitset<5> > myMap;
myMap[0] = 00000;
myMap[1] = 00001;
myMap[2] = 00010;
myMap[3] = 00011;
// Like this I have stored 0 to 25 numbers.
auto pos = myMap.find(2);
cout<< pos-> second <<endl; // output is 01000
pos = myMap.find(3);
cout<< pos->second <<endl; // output is 01001
pos = myMap.find(15);
cout<< pos->second <<endl; // output is 01001
pos = myMap.find(12);
cout<< pos->second <<endl; // output is 00000
return 0;
}
It seems that my output is wrong.
Where I am wrong ?