Advertisement
venik2405

lab6_1_max

May 24th, 2021
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main() {
  5. int a, b, c, d, res_c, res_asm = 0;
  6. cout << "This program calculates ((a * b * c) + 5) / (d - 1)" << endl;
  7. cout << "Input only 16bit numbers!" << endl;
  8. cout << "Input a: ";
  9. cin >> a;
  10. cout << "Input b: ";
  11. cin >> b;
  12. cout << "Input c: ";
  13. cin >> c;
  14. cout << "Input d: ";
  15. cin >> d;
  16. res_c = a * b * c + 5;
  17. res_c /= d - 1;
  18. __asm {
  19. mov eax, a
  20. mov ebx, b
  21. mul ebx
  22. mov ebx, c
  23. imul ebx
  24. add eax, 5
  25. mov ebx, d
  26. sub ebx, 1
  27. idiv ebx
  28. mov res_asm, eax
  29. }
  30. printf("Result c++: %d\nResult asm: %d\n", res_c, res_asm);
  31. system("pause");
  32. return 0;
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement