Tranvick

LENA2

Jun 24th, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     short x;
  7.     char s[5];
  8.     cin >> x;
  9.     _asm {
  10.         mov ax, x
  11.         mov ecx, 4
  12.         lea esi, s
  13.         add esi, 4
  14.         mov [esi], 0
  15.         dec esi
  16. _loop:
  17.         mov bx, ax
  18.         and bx, 15
  19.         cmp bx, 10
  20.         jge _ge
  21.         add bl, '0'
  22.         jmp _endif
  23. _ge:
  24.         add bl, 'A'
  25. _endif:
  26.         mov [esi], bl
  27.         dec esi
  28.         shr ax, 4
  29.         loop _loop
  30.     }
  31.     cout << s << endl;
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment