forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex17_9.cpp
33 lines (26 loc) · 980 Bytes
/
ex17_9.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/***************************************************************************
* @file main.cpp
* @author Alan.W
* @date 3 Mar 2014
* @remark This code is for the exercises from C++ Primer 5th Edition
* @note
***************************************************************************/
//
// Exercise 17.9: Explain the bit pattern each of the following bitset objects contains:
// (a) bitset<64> bitvec(32);
// 0000000000000000000000000000000000000000000000000000000000100000
// // ^
// (b) bitset<32> bv(1010101);
// 00000000000011110110100110110101
// // note that the argument here is decemal
// (c) string bstr; cin >> bstr; bitset<8>bv(bstr);
// depends on what has been input.
//
#include <iostream>
#include <bitset>
//#include "Sales_data.h"
int main()
{
std::bitset<32> bv(1010101);
std::cout << bv << std::endl;
}