daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <stdio.h>
  3. //#include <conio.h>
  4. using namespace std;
  5. int main()
  6. {
  7.     // long 8 int 4 short 2 char 1
  8.     long l = 25; int i = 25; short s = 25; char c = 25;
  9.     printf("%-10x %-10x %-10x %-10x\n", l, i, s, c);
  10.     cout<<hex<<showbase<<l<<" "<<i<<" "<<s<<" "<<c<<endl<<endl;
  11.  
  12.     printf("%-10x %-10x %-10x %-10x\n", ~l, ~i, ~s, ~c);
  13.     cout<<hex<<showbase<<~l<<" "<<~i<<" "<<~s<<" "<<~c<<endl<<endl;
  14.  
  15.     l=~l; i=~i; s=~s; c=~c;
  16.     printf("%-10x %-10x %-10x %-10x\n", l, i, s, c);
  17.     cout<<hex<<showbase<<l<<" "<<i<<" "<<s<<" "<<+c<<endl;
  18. }
  19.  
  20. /*
  21. Вывод:
  22. $ g++ kisa.cc -o kisa && chmod +x kisa && ./kisa && rm kisa
  23. 19         19         19         19
  24. 0x19 0x19 0x19
  25.  
  26. ffffffe6   ffffffe6   ffffffe6   ffffffe6
  27. 0xffffffffffffffe6 0xffffffe6 0xffffffe6 0xffffffe6
  28.  
  29. ffffffe6   ffffffe6   ffffffe6   ffffffe6
  30. 0xffffffffffffffe6 0xffffffe6 0xffe6 0xffffffe6
  31. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top