fork download
  1. , 8);
  2. printbits(res);
  3.  
  4. return 0;
  5. }
  6.  
  7. /*Извлекает n бит начиная с позиции p*/
  8. unsigned getbits(unsigned x, int p, int n){
  9. return (x >> (p+1-n)) & ~(~0 << n);
  10. }
  11.  
  12. unsigned int setbits(unsigned int x, int p, int n, unsigned int y){
  13. unsigned int bit_field;
  14.  
  15. /*Извлечем n крайних правых битов аргумента y*/
  16. bit_field = getbits(y, n, n);
  17.  
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: expected unqualified-id before ',' token
 , 8);
 ^
prog.cpp:1:3: error: expected unqualified-id before numeric constant
 , 8);
   ^
prog.cpp:2:11: error: expected constructor, destructor, or type conversion before '(' token
  printbits(res);
           ^
prog.cpp:4:3: error: expected unqualified-id before 'return'
   return 0;
   ^
prog.cpp:5:1: error: expected declaration before '}' token
 }
 ^
stdout
Standard output is empty