Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>=
- using namespace std;
- int main()
- {
- int t=1024;
- int x;
- cout << "dati intre 0 si 2048 x=" ;
- cin >> x;
- int y=x;
- int a=1,b=2,c=4,d=8,e=16,f=32,g=64,h=128,i=256,j=512,k=1024,l=2048;
- int c12,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0;
- cout<<" x=";
- c12=(x>=l)? 1:0 ;
- x=(x>=l)? x-l:x ;
- c11=(x>=k)? 1:0 ;
- x=(x>=k)? x-k:x ;
- c10=(x>=j)? 1:0 ;
- x=(x>=j)? x-j:x ;
- c9=(x>=i)? 1:0 ;
- x=(x>=i)? x-i:x ;
- c8=(x>=h)? 1:0 ;
- x=(x>=h)? x-h:x ;
- c7=(x>=g)? 1:0 ;
- x=(x>=g)? x-g:x ;
- c6=(x>=f)? 1:0 ;
- x=(x>=f)? x-f:x ;
- c5=(x>=e)? 1:0 ;
- x=(x>=e)? x-e:x ;
- c4=(x>=d)? 1:0 ;
- x=(x>=d)? x-d:x ;
- c3=(x>=c)? 1:0 ;
- x=(x>=c)? x-c:x ;
- c2=(x>=b)? 1:0 ;
- x=(x>=b)? x-b:x ;
- c1=(x>=a)? 1:0 ;
- x=(x>=a)? x-a:x ;
- c0=x;
- cout<<0<<" "<<c12<<" "<<c11<<" "<<c10<<" "<<c9<<" "<<c8<<" "<<c7<<" "<<c6<<" "<<c5<<" "<<c4<<" "<<c3<<" "<<c2<<" "<<c1<<" "<<c0<<" "<<endl;
- // int y;
- // cout << "dati intre o si 2048 y=" << endl ;
- // cin >=>= y;
- // int a=1,b=2,c=4,d=8,e=16,f=32,g=64,h=128,i=256,j=512,k=1024,l=2048;
- // int c12,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0;
- cout<<"-x=";
- c12=(y>=l)? 1:0 ;
- y=(y>=l)? y-l:y ;
- c11=(y>=k)? 1:0 ;
- y=(y>=k)? y-k:y ;
- c10=(y>=j)? 1:0 ;
- y=(y>=j)? y-j:y ;
- c9=(y>=i)? 1:0 ;
- y=(y>=i)? y-i:y ;
- c8=(y>=h)? 1:0 ;
- y=(y>=h)? y-h:y ;
- c7=(y>=g)? 1:0 ;
- y=(y>=g)? y-g:y ;
- c6=(y>=f)? 1:0 ;
- y=(y>=f)? y-f:y ;
- c5=(y>=e)? 1:0 ;
- y=(y>=e)? y-e:y ;
- c4=(y>=d)? 1:0 ;
- y=(y>=d)? y-d:y ;
- c3=(y>=c)? 1:0 ;
- y=(y>=c)? y-c:y ;
- c2=(y>=b)? 1:0 ;
- y=(y>=b)? y-b:y ;
- c1=(y>=a)? 1:0 ;
- y=(y>=a)? y-a:y ;
- c0=y;
- cout<<1<<" "<<c12<<" "<<c11<<" "<<c10<<" "<<c9<<" "<<c8<<" "<<c7<<" "<<c6<<" "<<c5<<" "<<c4<<" "<<c3<<" "<<c2<<" "<<c1<<" "<<c0<<" "<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement