Advertisement
karatanas

Untitled

Mar 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int perimeter_of_rectangle(int a, int b) {
  6. _asm {
  7. mov eax, a;
  8. add eax, b;
  9. }
  10.  
  11. }
  12.  
  13. void print_perimeter_of_rectangle(int a, int b) {
  14.  
  15. const char *f = "perimeter_of_rectangle(%d,%d) = %d\n";
  16.  
  17. _asm {
  18. mov eax, a;
  19. mov ebx, b;
  20.  
  21. push eax
  22. push ebx
  23. call perimeter_of_rectangle
  24.  
  25. push eax
  26.  
  27. mov eax,a
  28. mov ecx,b
  29.  
  30. push eax
  31. push ecx
  32.  
  33. push f
  34.  
  35. call printf
  36. add esp, 32
  37. }
  38. }
  39.  
  40.  
  41. int main()
  42. {
  43. char answer = 0;
  44.  
  45. print_perimeter_of_rectangle(5, 4);
  46.  
  47. cin >> answer;
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement