// program that prints the binary representation of a sequence of bits // with no bounds checking, so we can examine arbitrary parts of // memory. Similar situation using a vector. #include #include #include #include using namespace std; int main() { char text[4]; text[0] = 'f'; text[1] = 'u'; text[2] = 'n'; text[3] = '\0'; byte * p = (byte *) &text; for (int i = 0; i < 40; i++) { cout << "byte " << i << ": " << bitset<8>(to_integer(*p)) << endl; p++; } cout << endl; vector v; v.push_back(18); v.push_back(42); for (int i = 0; i < 100; i++) { cout << "v[" << i << "]: " << v[i] << endl; } return 0; }