Skip to content

Commit

Permalink
finished 17.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Jun 30, 2017
1 parent f5625cf commit cd2153e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ch17/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.

0 comments on commit cd2153e

Please sign in to comment.