Advertisement
MosTzz

Matrice

Jan 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // 1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. void compute(int*, int)
  7. {
  8. _asm {
  9. mov ebx,[ebp+8]
  10. mov esi,0
  11. fori:cmp esi,[ebp+12]
  12. jae stopfori
  13. mov edi,0
  14. forj:cmp edi,[ebp+12]
  15. jae stopforj
  16. mov eax,[ebp+12]
  17. mul esi
  18. add eax,edi
  19. mov ecx,esi
  20. add ecx,edi
  21. mov [ebx+4*eax],ecx
  22. inc edi
  23. jmp forj
  24. stopforj:inc esi
  25. jmp fori
  26. stopfori:
  27.  
  28. }
  29. }
  30.  
  31. int main()
  32. {
  33. int a[3][3], n;
  34. scanf_s("%d", &n);
  35. compute((int *)a, 3);
  36. for (int i = 0; i < n; i++)
  37. {
  38. for (int j = 0; j < n; j++)
  39.  
  40. printf("%d ", a[i][j]);
  41. printf("\n");
  42. }
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement