Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <bitset>
  3.  
  4. union U
  5. {
  6. unsigned int i;
  7. unsigned char byte[4];
  8. };
  9.  
  10. int main()
  11. {
  12. union U u;
  13. u.i = 0b00001000'00001001'00001011'00001111;
  14. std::cout << std::bitset<8>(u.byte[0]) << std::endl
  15. << std::bitset<8>(u.byte[1]) << std::endl
  16. << std::bitset<8>(u.byte[2]) << std::endl
  17. << std::bitset<8>(u.byte[3]) << std::endl;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement