I have a problem using bitsets from a char when I use indices.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
using namespace std;
int main()
{
char c = 'C';
bitset<7> b(c);
cout << b << endl;
for(int j = 0; j!=7;++j){
cout<<b[j];
}
return 0;
}
results
1000011
1100001
I must have forgotten something very simple. Can someone explain why the results of bitset is not the same when using indices and not?