SHARE
TWEET

Untitled

a guest Oct 16th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>=
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int t=1024;
  8.     int x;
  9.     cout << "dati intre 0 si 2048 x=" ;
  10.     cin >> x;
  11.     int y=x;
  12.     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;
  13.     int c12,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0;
  14.     cout<<" x=";
  15.     c12=(x>=l)? 1:0 ;
  16.     x=(x>=l)? x-l:x ;
  17.  
  18.     c11=(x>=k)? 1:0 ;
  19.     x=(x>=k)? x-k:x ;
  20.  
  21.     c10=(x>=j)? 1:0 ;
  22.     x=(x>=j)? x-j:x ;
  23.  
  24.     c9=(x>=i)? 1:0 ;
  25.     x=(x>=i)? x-i:x ;
  26.  
  27.     c8=(x>=h)? 1:0 ;
  28.     x=(x>=h)? x-h:x ;
  29.  
  30.     c7=(x>=g)? 1:0 ;
  31.     x=(x>=g)? x-g:x ;
  32.  
  33.     c6=(x>=f)? 1:0 ;
  34.     x=(x>=f)? x-f:x ;
  35.  
  36.     c5=(x>=e)? 1:0 ;
  37.     x=(x>=e)? x-e:x ;
  38.  
  39.     c4=(x>=d)? 1:0 ;
  40.     x=(x>=d)? x-d:x ;
  41.  
  42.     c3=(x>=c)? 1:0 ;
  43.     x=(x>=c)? x-c:x ;
  44.  
  45.     c2=(x>=b)? 1:0 ;
  46.     x=(x>=b)? x-b:x ;
  47.  
  48.     c1=(x>=a)? 1:0 ;
  49.      x=(x>=a)? x-a:x ;
  50.  
  51.     c0=x;
  52.     cout<<0<<" "<<c12<<" "<<c11<<" "<<c10<<" "<<c9<<" "<<c8<<" "<<c7<<" "<<c6<<" "<<c5<<" "<<c4<<" "<<c3<<" "<<c2<<" "<<c1<<" "<<c0<<" "<<endl;
  53.  
  54. //    int y;
  55.    // cout << "dati intre o si 2048 y=" << endl ;
  56.    // cin >=>= y;
  57.  
  58.  
  59.    // 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;
  60.    // int c12,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0;
  61.    cout<<"-x=";
  62.  
  63.     c12=(y>=l)? 1:0 ;
  64.     y=(y>=l)? y-l:y ;
  65.  
  66.     c11=(y>=k)? 1:0 ;
  67.     y=(y>=k)? y-k:y ;
  68.  
  69.     c10=(y>=j)? 1:0 ;
  70.     y=(y>=j)? y-j:y ;
  71.  
  72.     c9=(y>=i)? 1:0 ;
  73.     y=(y>=i)? y-i:y ;
  74.  
  75.     c8=(y>=h)? 1:0 ;
  76.     y=(y>=h)? y-h:y ;
  77.  
  78.     c7=(y>=g)? 1:0 ;
  79.     y=(y>=g)? y-g:y ;
  80.  
  81.     c6=(y>=f)? 1:0 ;
  82.     y=(y>=f)? y-f:y ;
  83.  
  84.     c5=(y>=e)? 1:0 ;
  85.     y=(y>=e)? y-e:y ;
  86.  
  87.     c4=(y>=d)? 1:0 ;
  88.     y=(y>=d)? y-d:y ;
  89.  
  90.     c3=(y>=c)? 1:0 ;
  91.     y=(y>=c)? y-c:y ;
  92.  
  93.     c2=(y>=b)? 1:0 ;
  94.     y=(y>=b)? y-b:y ;
  95.  
  96.     c1=(y>=a)? 1:0 ;
  97.      y=(y>=a)? y-a:y ;
  98.  
  99.     c0=y;
  100.     cout<<1<<" "<<c12<<" "<<c11<<" "<<c10<<" "<<c9<<" "<<c8<<" "<<c7<<" "<<c6<<" "<<c5<<" "<<c4<<" "<<c3<<" "<<c2<<" "<<c1<<" "<<c0<<" "<<endl;
  101.     return 0;
  102. }
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