Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- const int N = 1000;
- char str1[N];
- char str2[N];
- char* fmt = "%s";
- __asm {
- //AGAIN :
- mov eax, N
- push eax
- lea eax, str1
- push eax
- call dword ptr gets_s
- add esp, 8
- mov eax, N
- push eax
- lea eax, str2
- push eax
- call dword ptr gets_s
- add esp, 8
- lea edi,str1
- xor eax,eax
- cld
- mov ecx,0xFFFFFFFF
- repne scasb
- neg ecx
- mov ebx,ecx
- lea edi, str2
- xor eax, eax
- cld
- mov ecx, 0xFFFFFFFF
- repne scasb
- neg ecx
- cmp ebx,ecx
- jge NEXT
- push ecx
- call dword ptr malloc
- add esp, 4
- jmp NEXT1
- NEXT:
- push ebx
- call dword ptr malloc
- add esp, 4
- NEXT1:
- //адрес начала нового массива в eax
- mov edi,eax
- lea ebx,str1
- lea edx,str2
- xor ecx,ecx //длина получившегося массива
- CYCLE :
- inc ebx
- cmp byte ptr [ebx],0
- je FIN
- mov al,[ebx]
- CYCLE2 :
- inc edx
- cmp byte ptr [edx],0
- je CYCLE
- cmp al,[edx]
- je FOUND
- jmp CYCLE2
- jmp CYCLE
- FOUND :
- mov [eax+ecx],al
- inc ecx
- jmp CYCLE
- FIN :
- push edi
- lea ebx,fmt
- push ebx
- call dword ptr printf
- //спросить про ещё раз
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement