fork(3) download
  1. #include <stdio.h>
  2.  
  3. void binary_print(unsigned int value) {
  4. unsigned int mask = 0xff000000;
  5. unsigned int shift = 256*256*256;
  6. unsigned int byte, byte_iterator, bit_iterator;
  7.  
  8. for(byte_iterator = 0; byte_iterator < 4; byte_iterator++) {
  9. byte = (value & mask) / shift;
  10. printf(" ");
  11. for(bit_iterator = 0; bit_iterator < 8; bit_iterator++) {
  12. if(byte & 0x80)
  13. printf("1");
  14. else
  15. printf("0");
  16. byte *= 2;
  17. }
  18. mask /= 256;
  19. shift /= 256;
  20. }
  21. printf ("\n");
  22. }
  23.  
  24. int main()
  25. {
  26. int x = 173;
  27. binary_print (x);
  28.  
  29. __asm
  30. {
  31. pushad
  32. mov eax, x
  33. xor ebx, ebx
  34. xor ecx, ecx
  35. mov cl, 32
  36. next_bit:
  37. rcl eax, 1
  38. rcr ebx, 1
  39. loop next_bit
  40. mov x, ebx
  41. popad
  42. }
  43. binary_print (x);
  44. return 0;
  45. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:30:2: error: expected '(' before '{' token
  {
  ^
prog.cpp:31:3: error: 'pushad' was not declared in this scope
   pushad
   ^
stdout
Standard output is empty