YauhenMardan

UP_asm_2.2

May 20th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a, i=1;
  8. cout << "Type a" << endl;
  9. cin >> a;
  10. _asm {
  11. //abs
  12. mov eax,a
  13. cmp eax,0
  14. jge GRT_EQL
  15. mov ebx,-1
  16. imul ebx
  17. GRT_EQL:
  18. //count order
  19. beg_ord :
  20. cmp eax, 10
  21. jl end_ord
  22. mov ebx, 10
  23. xor edx, edx
  24. cdq
  25. idiv ebx
  26. //i++
  27. mov ebx, i
  28. add ebx, 1
  29. mov i, ebx
  30. jmp beg_ord
  31. end_ord :
  32. }
  33. cout << "Order: " << i << endl;
  34. system("pause");
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment