Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /*
- f(x,y)=(x^2+y^2)/(x-y) if, x!=y
- 0,x=y
- */
- using namespace std;
- int f(int x, int y){
- __asm{
- mov eax, x
- mov ebx, y
- cmp eax, ebx
- je ZERO
- imul eax; беззнаковое умножение
- imul ebx, ebx; уммножение вида риемник, источник
- add eax, ebx
- mov ebx, x
- sub ecx, ebx
- cdq
- idiv ecx;
- jmp END
- ZERO : mov eax, 0
- END :
- }
- }
- int main()
- {
- int a = 2, b = 3, c;
- __asm{
- mov eax, b
- push eax
- mov eax, a
- push eax
- call dword ptr f
- pop ebx
- pop ecx
- mov c, eax
- }
- cout << c << endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement