Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, ".1251");
- char* firstNum = new char[255];
- char* secondNum = new char[255];
- char* answer = new char[300];
- cout << "Enter first BigNum: ";
- cin.getline(firstNum, 255);
- for (int i = 0; i < strlen(firstNum); i++)
- {
- if (isalpha(firstNum[i]))
- {
- cout << "Wrond first BigNum!\n";
- return 1;
- }
- }
- cout << "Enter second BigNum: ";
- cin.getline(secondNum, 255);
- for (int i = 0; i < strlen(secondNum); i++)
- {
- if (isalpha(secondNum[i]))
- {
- cout << "Wrond second BigNum!\n";
- return 1;
- }
- }
- bool firstMore = false;
- int firstLen = strlen(firstNum) - 1, secondLen = strlen(secondNum) - 1;
- if (firstLen - secondLen >= 0)
- firstMore = true;
- if (firstMore)
- {
- _asm
- {
- mov eax, 0; десяток
- mov ecx, 0; итерактивная сумма
- mov esi, firstNum
- mov edi, secondNum
- mov eci, answer;
- add esi, firstLen
- add edi, secondLen
- _start:
- cmp edi, 0
- je _fillEmpty
- add ecx, [esi]
- add ecx, [edi]
- add ecx, eax
- cmp ecx, 10
- jg _greater
- jmp _lower
- _greater:
- mov AL, ecx
- mov BL, 10
- DIV BL
- mov [eci], BL
- DEC eci
- DEC esi
- DEC edi
- add eax, AL
- jmp _start
- _lower:
- mov [eci], ecx
- mov eax, 0
- DEC eci
- DEC esi
- DEC edi
- jmp _start
- _fillEmpty:
- cmp esi, 0
- jg _fill
- jmp _exit
- _fill:
- mov [eci], [esi]
- DEC eci
- DEC esi
- jmp _fillEmpty
- _exit:
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement