Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://vk.com/evgenykravchenko0
- ___ ___ ___
- / /\ ___ / /\ / /\
- / /:/_ /__/\ / /:/_ / /:/_
- / /:/ /\ \ \:\ / /:/ /\ / /:/ /\
- / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_
- /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\
- \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/
- \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/
- \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/
- \ \::/ \__\::::/ \ \::/ \ \::/
- \__\/ ~~~~ \__\/ \__\/
- ___
- /__/\ ___ ___
- \ \:\ / /\ / /\
- \ \:\ / /:/ / /:/
- _____\__\:\ /__/::\ /__/::\
- /__/::::::::\ \__\/\:\__ \__\/\:\__
- \ \:\~~\~~\/ \ \:\/\ \ \:\/\
- \ \:\ ~~~ \__\::/ \__\::/
- \ \:\ /__/:/ /__/:/
- \ \:\ \__\/ \__\/
- \__\/
- #include "pch.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main(int argc, const char * argv[])
- {
- int x = 0;
- int y = 0;
- int temp = 0;
- int A[3];
- int B[3];
- int C[3];
- int result_asm = 0;
- int result_cpp = 0;
- int temp_a = 0;
- int temp_b = 0;
- int temp_c = 0;
- cout << "Prog calc ∑(Ai * X) + ∑(Bi*XY) + ∑(Ci)*Y " << endl;
- cout << "Enter value of X : ";
- cin >> x;
- cout << "Enter value of Y : ";
- cin >> y;
- cout << "Enter elements of array A :" << endl;
- for ( int i = 0; i < 3; i++)
- {
- cout << " A[" << i << "] : ";
- cin >> A[i];
- }
- cout << "Enter elements of array B :" << endl;
- for ( int i = 0; i < 3; i++)
- {
- cout << " B[" << i << "] : ";
- cin >> B[i];
- }
- cout << "Enter elements of array C :" << endl;
- for ( int i = 0; i < 3; i++)
- {
- cout << " C[" << i << "] : ";
- cin >> C[i];
- }
- for ( int i = 0; i < 3; i++)
- {
- temp_a = temp_a + A[i] * x;
- temp_b = temp_b + B[i] * x * y;
- temp_c = temp_c + C[i];
- }
- result_cpp = temp_a + temp_b + temp_c * y;
- _asm
- {
- mov eax , x
- imul y
- mov temp , eax
- mov eax, 0
- mov esi, 0
- mov ecx, 3
- lea ebx, A
- cycl1 :
- mov eax, [ebx]
- imul x
- add ebx, 4
- add esi, eax
- loop cycl1
- mov x , esi
- mov esi, 0
- mov eax, 0
- mov ecx, 3
- lea ebx, B
- cycl2 :
- mov eax, [ebx]
- imul temp
- add esi, eax
- add ebx, 4
- loop cycl2
- mov temp, esi
- mov eax, 0
- mov ecx, 3
- lea ebx, C
- cycl3 :
- add eax, [ebx]
- add ebx, 4
- loop cycl3
- imul y
- add eax, temp
- add eax, x
- mov result_asm , eax
- }
- cout << "Result on ASM : " << result_asm << endl;
- cout << "Result on C++ : " << result_cpp << endl;
- cin >> x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement