fork download
  1. #include <iostream>
  2. #include <bitset>
  3.  
  4. using namespace std;
  5. union kuba {
  6. short liczba;
  7. bool bit;
  8. };
  9.  
  10. int main() {
  11. kuba un;
  12. un.liczba = -32767;
  13. short sracz = -32767;
  14. //cout << un.rozbicie.b << '\n';
  15. //char* LowBit = (char *)sracz;
  16. //char* HiBit = LowBit + 1;
  17.  
  18. cout << bitset<16>(sracz) << '\n';
  19. cout << un.bit;
  20. //cout << ((1 >> 15) & sracz );
  21. //cout << *LowBit << '\n';
  22. //cout << *HiBit << '\n';
  23.  
  24.  
  25.  
  26. return 0;
  27.  
  28. }
  29.  
  30.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1000000000000001
1