3 / 208__159_N_771__128__208__208__186_N_771__130__208__184__208__186__208__3__208__208_N_771__129_N_771__140__208__186__208__190__208__178
.docx#include "pch.h"
#include <iostream>
int main()
{
short a;
short b;
short c;
short d;
std::cout << "chislo a ";
std::cin >> a;
std::cout << "chislo b ";
std::cin >> b;
std::cout << "chislo c ";
std::cin >> c;
std::cout << "chislo d ";
std::cin >> d;
short Summa = a + b;
std::cout << "A + B = " << Summa << std::endl;
short SummaAsm;
_asm {
mov AX, a
add AX, b
mov SummaAsm, AX
}
std::cout << "ASM A + B = " << SummaAsm << std::endl;
short Raznost = a - b;
std::cout << "A - B = " << Raznost << std::endl;
short Raz;
_asm {
mov AX, a
sub AX, b
mov Raz, AX
}
std::cout << "ASM A - B = " << Raz << std::endl;
short SumRaz = a + b - c;
std::cout << "A + B - C = " << SumRaz << std::endl;
short SumRazAsm;
_asm {
mov AX, a
add AX, b
sub AX, c
mov SumRazAsm, AX
}
std::cout << "ASM A + B - C = " << SumRazAsm << std::endl;
short Proiz1 = (a + b)*(c + a);
std::cout << "(A + B)*(C + A) = " << Proiz1 << std::endl;
short Proiz1Asm;
_asm {
mov AX, a
mov BX, c
add AX, b
add BX, a
mul BX
mov Proiz1Asm, AX
}
std::cout << "ASM (A + B)*(C + A) = " << Proiz1Asm << std::endl;
short Proiz2 = (a + b + c)*(c - a + b);
std::cout << "(A + B + C)*(C - A + B) = " << Proiz2 << std::endl;
short Proiz2Asm;
_asm {
mov AX, a
mov BX, c
add AX, b
add AX, c
sub BX, a
add BX, b
mul BX
mov Proiz2Asm, AX
}
std::cout << "ASM (A + B + C)*(C - A + B) = " << Proiz2Asm << std::endl;
short StepenC = pow(c, 4);
short Proiz3 = (a + b)*StepenC;
std::cout << "(A + B) * C**4 = " << Proiz3 << std::endl;
short Proiz3Asm;
_asm {
mov AX, c
mov BX, AX
mul BX
mul BX
mul BX
mov CX, a
add CX, b
mul CX
mov Proiz3Asm, AX
}
std::cout << "ASM (A + B) * C**4 = " << Proiz3Asm << std::endl;
short Proiz4 = ((a + b)*c - (d + c)*b)*a;
std::cout << "((A + B)*C - (D + C)*B)*A = " << Proiz4 << std::endl;
short Proiz4Asm;
_asm {
mov AX, a
add AX, b
mul c
mov BX, AX
mov AX, d
add AX, c
mul b
mov CX, AX
sub BX, CX
mov AX, BX
mul a
mov Proiz4Asm, AX
}
std::cout << "ASM ((A + B)*C - (D + C)*B)*A = " << Proiz4Asm << std::endl;
short Proiz5 = (((a - c)*b + d)*a - c)*b;
std::cout << "(((A - C)*B + D)*A - C)*B = " << Proiz5 << std::endl;
short Proiz5Asm;
_asm {
mov AX, a
sub AX, c
mul b
add AX, d
mul a
sub AX, c
mul b
mov Proiz5Asm, AX
}
std::cout << "ASM (((A - C)*B + D)*A - C)*B = " << Proiz5Asm << std::endl;
short OperAND = a & b;
std::cout << "A and B = " << OperAND << std::endl;
short OperANDasm;
_asm {
mov ax, a
mov bx, b
and ax, bx
mov OperANDasm, ax
}
std::cout << "(ASM) A and B = " << OperANDasm << std::endl;
short OperOR = a | b;
std::cout << "A or B = " << OperOR << std::endl;
short OperORasm;
_asm {
mov ax, a
mov bx, b
or ax, bx
mov OperORasm, ax
}
std::cout << "(ASM) A or B = " << OperORasm << std::endl;
short OperNOT = ~a;
std::cout << "not A = " << OperNOT << std::endl;
short OperNOTasm;
_asm {
mov ax, a
not ax
mov OperNOTasm, ax
}
std::cout << "(ASM) not A = " << OperNOT << std::endl;
short OperXOR = a ^ b;
std::cout << "A xor B = " << OperXOR << std::endl;
short OperXORasm;
_asm {
mov ax, a
mov bx, b
xor ax, bx
mov OperXORasm, ax
}
std::cout << "(ASM) A xor B = " << OperXORasm << std::endl;
}