bitset declaration c 2b 2b

Solutions on MaxInterview for bitset declaration c 2b 2b by the best coders in the world

showing results for - "bitset declaration c 2b 2b"
Melina
03 Jul 2020
1// constructing bitsets
2#include <iostream>       // std::cout
3#include <string>         // std::string
4#include <bitset>         // std::bitset
5
6int main ()
7{
8  std::bitset<16> foo;
9  std::bitset<16> bar (0xfa2);
10  std::bitset<16> baz (std::string("0101111001"));
11
12  std::cout << "foo: " << foo << '\n';
13  std::cout << "bar: " << bar << '\n';
14  std::cout << "baz: " << baz << '\n';
15
16  return 0;
17}