1#include <bitset>
2...
3
4char a = -58;
5std::bitset<8> x(a);
6std::cout << x << '\n';
7
8short c = -315;
9std::bitset<16> y(c);
10std::cout << y << '\n';
1#include <iostream>
2#include <bitset>
3
4int main() {
5 int a = -58, b = a>>3, c = -315;
6
7 std::cout << "a = " << std::bitset<8>(a) << std::endl;
8 std::cout << "b = " << std::bitset<8>(b) << std::endl;
9 std::cout << "c = " << std::bitset<16>(c) << std::endl;
10}
11