include conio include stdio include locale include iostream include wi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <conio.h>
#include <stdio.h>
#include <locale>
#include <iostream>
#include <windows.h>
#include <math.h>
using namespace std;
int amper(int x, int y)
{if(x==1 & y==1) return 1;else return 0;}
int ne(int x)
{if (x==1) return 0; else return 1;}
int Shefer(int x,int y)
{if(x+y==2) return 0; else return 1;}
int Ekv(int x, int y)
{if(x==y) return 1;else return 0;}
int Imp(int x,int y)
{
if(x+y==2) return 1;
else
{
if(x==0&&y==1) return 1;
if(x==0&&y==0) return 1;
}
return 0;
}
int V(int x, int y)
{if(x==0&&y==0) return 0; else return 1;}
void main()
{
SetConsoleOutputCP(1251);
int x[10],y[10],z[10],i;
x[0]=0;x[1]=0;x[2]=0;x[3]=1;x[4]=0;x[5]=1;x[6]=1;x[7]=1;
y[0]=0;y[1]=0;y[2]=1;y[3]=0;y[4]=1;y[5]=0;y[6]=1;y[7]=1;
z[0]=0;z[1]=1;z[2]=0;z[3]=0;z[4]=1;z[5]=1;z[6]=0;z[7]=1;
printf("F1: _x&y -> (y|_z)->(x~x&z) \n\n_x&y : ");
for(i=0;i<8;i++)
printf("%d ",amper((ne(x[i])),(y[i])));
printf("\ny|_z : ");
for(i=0;i<8;i++)
printf("%d ",Shefer( (y[i]), (ne (z[i]))) );
printf("\nx&z : ");
for(i=0;i<8;i++)
printf("%d ", amper((x[i]),(z[i])) );
printf("\nx~x&z : ");
for(i=0;i<8;i++)
printf("%d ", Ekv(x[i],(amper((x[i]),(z[i])))) );
printf("\n(y|_z)->(x~x&z) : ");
for(i=0;i<8;i++)
printf("%d ", Imp( (Shefer( (y[i]), (ne (z[i])))) ,(Ekv(x[i],(amper((x[i]),(z[i]))))) ) );
printf("\n! _x&y -> (y|_z)->(x~x&z) : ");
for(i=0;i<8;i++)
printf("%d ", Imp( (amper((ne(x[i])),(y[i]))) , (Imp( (Shefer( (y[i]), (ne (z[i])))) ,(Ekv(x[i],(amper((x[i]),(z[i]))))) )) ) );
printf("\n\n F2: (x&y) v ( _(x->(xvy)) -> z)");
printf("\nx&y : ");
for(i=0;i<8;i++)
printf("%d ", amper( (x[i]) , (y[i]) ) );
printf("\nxvy : ");
for(i=0;i<8;i++)
printf("%d ", V((x[i]),(y[i])) );
printf("\n_(x->(xvy) : ");
for(i=0;i<8;i++)
printf("%d ", ne(Imp( (x[i]),(V((x[i]),(y[i]))) )) );
printf("\n( _(x->(xvy)) -> z) : ");
for(i=0;i<8;i++)
printf("%d ", Imp( (ne(Imp( (x[i]),(V((x[i]),(y[i]))) ))) , (z[i]) ));
printf("\n! (x&y) v ( _(x->(xvy)) -> z) : ");
for(i=0;i<8;i++)
printf("%d ", V( (amper( (x[i]) , (y[i]) )) , (Imp( (ne(Imp( (x[i]),(V((x[i]),(y[i]))) ))) , (z[i]) )) ) );
_getch();
}