YauhenMardan

UP_asm_1.3

May 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int x, s, z,answ;
  9. cout << "Type x" << endl;
  10. cin >> x;
  11. cout << "Type s" << endl;
  12. cin >> s;
  13. cout << "Type z" << endl;
  14. cin >> z;
  15. _asm{
  16. mov eax,x
  17. mov ebx,z
  18. imul ebx
  19. add eax,s
  20. cmp eax,0
  21. je EQL
  22. mov ecx,eax
  23. mov eax,s
  24. imul ebx
  25. mov ebx,eax
  26. mov eax,x
  27. sub eax,ebx
  28. mov ebx,s
  29. imul ebx
  30. cdq
  31. idiv ecx
  32. mov answ,eax
  33. jmp ANSW_
  34. }
  35. EQL:
  36. cout << "division by 0 is impossible " << endl;
  37. goto END;
  38. ANSW_:
  39. cout << "answer = " << answ << endl;
  40. END:
  41. system("pause");
  42. return 0;
  43. }
Add Comment
Please, Sign In to add comment