Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void BIT(unsigned value)
  5. {
  6. int i;
  7. for (i = 7; i >= 0; i--)
  8. {
  9. if (i == 3)
  10. {
  11. cout << " ";
  12. };
  13.  
  14. char vs = (1 << i) & value;
  15. if (vs)
  16. {
  17. cout << "1";
  18. }
  19. else
  20. {
  21. cout << "0";
  22. }
  23. }
  24. }
  25.  
  26.  
  27. int main()
  28. {
  29. BIT(213);
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement