//https://vk.com/evgenykravchenko0 ___ ___ ___ / /\ ___ / /\ / /\ / /:/_ /__/\ / /:/_ / /:/_ / /:/ /\ \ \:\ / /:/ /\ / /:/ /\ / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_ /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\ \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/ \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/ \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/ \ \::/ \__\::::/ \ \::/ \ \::/ \__\/ ~~~~ \__\/ \__\/ ___ /__/\ ___ ___ \ \:\ / /\ / /\ \ \:\ / /:/ / /:/ _____\__\:\ /__/::\ /__/::\ /__/::::::::\ \__\/\:\__ \__\/\:\__ \ \:\~~\~~\/ \ \:\/\ \ \:\/\ \ \:\ ~~~ \__\::/ \__\::/ \ \:\ /__/:/ /__/:/ \ \:\ \__\/ \__\/ \__\/ #include #include using namespace std; int main(int argc, const char * argv[]) { int x = 0; int y = 0; int temp_a = 0; int temp_b = 0; int temp_c = 0; int result_a = 0; int result_b = 0; int result_c = 0; int size; int result_asm = 0; int result_cpp = 0; cout << "Enter size of array: "; cin >> size; int a[size]; int b[size]; int c[size]; for( int i = 1; i <= size; i++) { cout << "Enter value of A[" << i << "] = "; cin >> a[i]; cout << "Enter value of B[" << i << "] = "; cin >> b[i]; cout << "Enter value of C[" << i << "] = "; cin >> c[i]; } cout << "//Prog calc ∑(Ai * X) + ∑(Bi*XY) + ∑(Ci)*Y " << endl; cout << "Enter value of X: "; cin >> x; cout << "Enter value of Y: "; cin >> y; // цикл для вычисления на асемблер for ( int i = 1; i <= size; i++) { temp_a = a[i]; temp_b = b[i]; temp_c = c[i]; asm { mov eax , temp_a imul x mov temp_a , eax mov eax , result_a add eax , temp_a mov result_a , eax mov eax , temp_b imul x imul y mov temp_b , eax mov eax , result_b add eax , temp_b mov result_b , eax mov eax , result_c add eax , temp_c mov result_c , eax } } asm { mov eax , result_c imul y add eax , result_b mov result_b , eax mov eax , result_b add eax , result_a mov result_asm , eax } temp_a = 0; temp_b = 0; temp_c = 0; // цикл для вычислений на С++ //Prog calc ∑(Ai * X) + ∑(Bi*XY) + ∑(Ci)*Y for ( int i = 1; i <= size; 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); cout << "Result on asm : " << result_asm << endl; cout << "Result on C++ : " << result_cpp << endl ; return 0; }