Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main(int argc, char** argv) {
  9. string str = argv[1];
  10. int strlen;
  11. int result = 0;
  12. int memory;
  13. strlen = str.length();
  14. char c[10];
  15. for (int i = 0; i < strlen; i++)
  16. {
  17. c[i] = str[i];
  18. }
  19.  
  20. _asm {
  21. push eax
  22. push ebx
  23. push ecx
  24. push edx
  25. mov eax, 0
  26.  
  27. mov edx, strlen
  28. dec edx//kiek kartu reik pakelt sk * 10
  29. for_loop :
  30.  
  31. cmp eax, strlen
  32. je exit_loop
  33. mov memory, eax
  34. mov al, c[eax]
  35. sub al, 48
  36. movzx ebx, al
  37. mov ecx, 0
  38. mov eax, memory
  39.  
  40. multiplynumber ://kiek kartu daugint
  41. cmp ecx, edx
  42. je multiplyend
  43. mov memory, ecx
  44. mov ecx, 10
  45. imul ebx, ecx
  46. mov ecx, memory
  47. inc ecx
  48. jmp multiplynumber
  49. multiplyend :
  50.  
  51. mov ecx, result//prideti prie rezultato
  52. add ecx, ebx
  53. mov result, ecx
  54.  
  55. inc eax
  56. dec edx
  57.  
  58.  
  59. jmp for_loop
  60. exit_loop :
  61.  
  62.  
  63.  
  64. pop edx
  65. pop ecx
  66. pop ebx
  67. pop eax
  68. }
  69. cout << "Baigta " << result << endl;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement