#include <windows.h>
#include <stdio.h>
#include <conio.h>
bool CalcMethod_1(bool x1, bool x2, bool x3, bool x4)
{
return (((x1 | x2 | x3) & x2) | ((x2 | x3 | x4) & x3));
}
bool CalcMethod_2(bool x1, bool x2, bool x3, bool x4)
{
return (((x1 || x2 || x3) && x2) || ((x2 || x3 || x4) && x3));
}
int main()
{
printf("Truth table:\n");
printf("x1\tx2\tx3\tx4\ty1\ty2\n");
for (int x1=0; x1<2; x1++)
for (int x2=0; x2<2; x2++)
for (int x3=0; x3<2; x3++)
for (int x4=0; x4<2; x4++)
printf("%d\t%d\t%d\t%d\t%d\t%d\n",x1,x2,x3,x4,
CalcMethod_1(x1,x2,x3,x4), CalcMethod_2(x1,x2,x3,x4));
getch();
return 0;
}
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.