I\'m working my way through some C++ training. So far so good, but I need some help reinforcing some of the concepts I am learning. My question is how do I go about visualiz
A little bit by bit console program i whipped up, hope it helps somebody
#include
#include
#include
using namespace std;
typedef vector ByteVector;
///////////////////////////////////////////////////////////////
uint8_t Flags[8] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void print_bytes(ByteVector Bv){
for (unsigned i = 0; i < Bv.size(); i++){
printf("Byte %d [ ",i);
for (int j = 0;j < 8;++j){
Bv[i] & Flags[j] ? printf("1") : printf("0");
}
printf("]\n");
}
}
int main(){
ByteVector Bv;
for (int i = 0; i < 4; ++i) { Bv.push_back(i); }
print_bytes(Bv);
}