YauhenMardan

asm_8.12_b

May 17th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int n = 6;
  6. const int k = 3;
  7. int n_ = n;
  8. int main() {
  9. int a[n], b[k];
  10. cout << "Fill the first 'a' array:" << endl;
  11. for (int i = 0; i < n; i++) {
  12. cin >> a[i];
  13. }
  14. cout << "Fill the second 'b' array:" << endl;
  15. for (int i = 0; i < k; i++) {
  16. cin >> b[i];
  17. }
  18. _asm {
  19. mov ecx,k
  20. mov edi,0
  21. beg_:
  22. mov ebx,b[edi]
  23.  
  24. mov esi,0
  25. mov edx,ecx //save ecx
  26. mov ecx,n_
  27. beg2_:
  28. cmp ebx,a[esi]
  29. je EQL
  30. add esi, 4
  31. jmp NXT
  32. EQL:
  33. //----
  34. mov a[esi],99
  35. add esi, 4
  36. //----
  37. NXT:
  38. loop beg2_
  39.  
  40. mov ecx,edx //load ecx
  41. add edi,4
  42. loop beg_
  43. }
  44. cout << "The third 'a' array:" << endl;
  45. for (int i = 0; i < n_; i++) {
  46. cout << a[i]<<endl;
  47. }
  48. system("pause");
  49. return 0;
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment