Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int main(int argc, char** argv) {
- string str = argv[1];
- int strlen;
- int result = 0;
- int memory;
- strlen = str.length();
- char c[10];
- for (int i = 0; i < strlen; i++)
- {
- c[i] = str[i];
- }
- _asm {
- push eax
- push ebx
- push ecx
- push edx
- mov eax, 0
- mov edx, strlen
- dec edx//kiek kartu reik pakelt sk * 10
- for_loop :
- cmp eax, strlen
- je exit_loop
- mov memory, eax
- mov al, c[eax]
- sub al, 48
- movzx ebx, al
- mov ecx, 0
- mov eax, memory
- multiplynumber ://kiek kartu daugint
- cmp ecx, edx
- je multiplyend
- mov memory, ecx
- mov ecx, 10
- imul ebx, ecx
- mov ecx, memory
- inc ecx
- jmp multiplynumber
- multiplyend :
- mov ecx, result//prideti prie rezultato
- add ecx, ebx
- mov result, ecx
- inc eax
- dec edx
- jmp for_loop
- exit_loop :
- pop edx
- pop ecx
- pop ebx
- pop eax
- }
- cout << "Baigta " << result << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement