Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- short x;
- char s[5];
- cin >> x;
- _asm {
- mov ax, x
- mov ecx, 4
- lea esi, s
- add esi, 4
- mov [esi], 0
- dec esi
- _loop:
- mov bx, ax
- and bx, 15
- cmp bx, 10
- jge _ge
- add bl, '0'
- jmp _endif
- _ge:
- add bl, 'A'
- _endif:
- mov [esi], bl
- dec esi
- shr ax, 4
- loop _loop
- }
- cout << s << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment