Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int n = 6;
- const int k = 3;
- int n_ = n;
- int t;
- int main() {
- int a[n], b[k];
- cout << "Fill the first 'a' array:" << endl;
- for (int i = 0; i < n; i++) {
- cin >> a[i];
- }
- cout << "Fill the second 'b' array:" << endl;
- for (int i = 0; i < k; i++) {
- cin >> b[i];
- }
- _asm {
- mov ecx, k
- mov edi, 0
- beg_:
- mov esi, 0
- mov edx, ecx //save ecx
- mov ecx, n_
- beg2_ :
- mov ebx, b[edi]
- cmp ebx, a[esi]
- je EQL
- add esi, 4
- jmp NXT
- EQL :
- //----
- mov ebx,ecx // save ecx
- mov t,esi //save esi
- mov ecx,n_
- beg_shift_:
- cmp ecx,1
- je NNN
- add esi,4
- mov eax,a[esi]
- sub esi,4
- mov a[esi],eax
- add esi, 4
- loop beg_shift_
- NNN:
- mov eax, n_ //n_--
- sub eax,1
- mov n_,eax
- mov ecx, ebx // load ecx
- mov esi, t //load esi
- //add ecx,1
- //----
- NXT :
- loop beg2_
- mov ecx, edx //load ecx
- add edi, 4
- loop beg_
- }
- cout << "The third 'a' array:" << endl;
- for (int i = 0; i < n_; i++) {
- cout << a[i] << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement