From cd2153e22452722767dd8f5adb683afa8b63691a Mon Sep 17 00:00:00 2001 From: pezy_mbp Date: Fri, 30 Jun 2017 23:00:12 +0800 Subject: [PATCH] finished 17.2.1 --- ch17/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ch17/README.md b/ch17/README.md index 8a29e29a..2671eabb 100644 --- a/ch17/README.md +++ b/ch17/README.md @@ -52,4 +52,18 @@ I prefer the tuple version, because this version is more flexible. > What would happen if we passed `Sales_data()` as the third parameter to accumulate in the last code example in this section? Nothing happened, it's the same as passed `Sales_data(s)`. -Because `std::accumulate`'s third parameter is the initial value of the sum. It's will be zero whether `Sales_data()` or `Sales_data(s)`. Check the constructor of `Sales_data` and the `operator+=` member for more information. \ No newline at end of file +Because `std::accumulate`'s third parameter is the initial value of the sum. It's will be zero whether `Sales_data()` or `Sales_data(s)`. Check the constructor of `Sales_data` and the `operator+=` member for more information. + +## Exercise 17.9 + +>Explain the bit pattern each of the following `bitset` objects contains: + +```cpp +(a) bitset<64> bitvec(32); +(b) bitset<32> bv(1010101); +(c) string bstr; cin >> bstr; bitset<8> bv(bstr); +``` + +(a): 64 bits, lower-order 6 bits are `100000`, remaining bits are 0. +(b): 00000000000011110110100110110101 +(c): depends on what user has been input. \ No newline at end of file