Created
December 13, 2012 09:37
-
-
Save spellancer/4275280 to your computer and use it in GitHub Desktop.
model-lab-4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include<vector> | |
#include<math.h> | |
using namespace std; | |
int sum(int a,int b) | |
{ | |
int mas[2][2]={{0,1},{1,1}}; | |
int aplusb; | |
aplusb=mas[a][b]; | |
return aplusb; | |
} | |
int umn(int a,int b) | |
{ | |
int mas[2][2]={{0,0},{0,1}}; | |
int aplusb; | |
aplusb=mas[a][b]; | |
return aplusb; | |
} | |
int ne(int a) | |
{ | |
int mas[2]={1,0}; | |
int aplusb; | |
aplusb=mas[a]; | |
return aplusb; | |
} | |
int noizm(int a,int b,int c,int d) | |
{ | |
int f,g,h,j,i,k,l,z; | |
g = umn(b,d); | |
f = umn(a,g); | |
h = ne(umn(c,d)); | |
j = ne(umn(g,h)); | |
i = ne(umn(f,h)); | |
k = sum(j,c); | |
l = umn(f,k); | |
z = sum(i,l); | |
return z; | |
} | |
int izmper(int a,int b,int c,int d) | |
{ | |
int f,g,h,j,i,k,l,z,f1,f2,g1,g2,h1,h2,d1,d2,c1,c2; | |
d1 = d; | |
d2 = d; | |
c1 = c; | |
c2 = c; | |
g = umn(b,d1); | |
g1 = g; | |
g2 = g; | |
f = umn(a,g1); | |
f1 = f; | |
f2 = f; | |
h = ne(umn(c1,d2)); | |
h1 = h; | |
h2 = h; | |
j = ne(umn(g2,h1)); | |
k = sum(j,c2); | |
i = ne(umn(f1,h2)); | |
l = umn(k,f2); | |
z = sum(i,l); | |
return z; | |
} | |
int prov() | |
{ | |
int um,um1; | |
int mas[16][4] = {{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{0,1,0,0},{0,1,0,1},{0,1,1,0},{0,1,1,1},{1,0,0,0},{1,0,0,1},{1,0,1,0},{1,0,1,1},{1,1,0,0},{1,1,0,1},{1,1,1,0},{1,1,1,1}}; | |
for(int i=0;i<=15;i++) | |
{ | |
um = noizm(mas[i][0],mas[i][1],mas[i][2],mas[i][3]); | |
um1 = izmper(mas[i][0],mas[i][1],mas[i][2],mas[i][3]); | |
if (um == um1) | |
{ | |
cout<<"При a = "<<mas[i][0]<<", b = "<<mas[i][1]<<", d = "<<mas[i][2]<<", e = "<<mas[i][3]<<'\n'; | |
cout<<"Результат вычисления: "<<um<<"\nРезультат с замыканием: "<<um1<<"\n"; | |
} | |
else | |
{ | |
cout<<"При a = "<<mas[i][0]<<", b = "<<mas[i][1]<<", d = "<<mas[i][2]<<", e = "<<mas[i][3]<<'\n'; | |
cout<<"Результат вычисления: "<<um<<"\nРезультат с замыканием: "<<um1<<"\n"; | |
cout<<"Ошибка\n"; | |
break; | |
} | |
} | |
} | |
int main() | |
{ | |
prov(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment