Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- //#include <conio.h>
- using namespace std;
- int main()
- {
- // long 8 int 4 short 2 char 1
- long l = 25; int i = 25; short s = 25; char c = 25;
- printf("%-10x %-10x %-10x %-10x\n", l, i, s, c);
- cout<<hex<<showbase<<l<<" "<<i<<" "<<s<<" "<<c<<endl<<endl;
- printf("%-10x %-10x %-10x %-10x\n", ~l, ~i, ~s, ~c);
- cout<<hex<<showbase<<~l<<" "<<~i<<" "<<~s<<" "<<~c<<endl<<endl;
- l=~l; i=~i; s=~s; c=~c;
- printf("%-10x %-10x %-10x %-10x\n", l, i, s, c);
- cout<<hex<<showbase<<l<<" "<<i<<" "<<s<<" "<<+c<<endl;
- }
- /*
- Вывод:
- $ g++ kisa.cc -o kisa && chmod +x kisa && ./kisa && rm kisa
- 19 19 19 19
- 0x19 0x19 0x19
- ffffffe6 ffffffe6 ffffffe6 ffffffe6
- 0xffffffffffffffe6 0xffffffe6 0xffffffe6 0xffffffe6
- ffffffe6 ffffffe6 ffffffe6 ffffffe6
- 0xffffffffffffffe6 0xffffffe6 0xffe6 0xffffffe6
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement