Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- // ororo, gaijin code
- // aqrrays for input
- bool x1[8];
- bool x2[8];
- bool x3[8];
- bool x4[8];
- // arrays for storing result
- bool res1[8];
- bool res2[8];
- bool res3[8];
- bool res4[8];
- bool res5[8];
- // int for exception and prevent closing program
- int temp;
- // 4-floured m(s?)atanic functions
- bool func1(bool, bool, bool, bool);
- bool func2(bool, bool, bool, bool);
- bool func3(bool, bool, bool, bool);
- bool func4(bool, bool, bool, bool);
- bool func5(bool, bool, bool, bool);
- void input();
- void doFunctions();
- void output();
- void pause();
- bool func1(bool a1, bool a2, bool a3, bool a4){
- return((not((not(a1) and (not(a2) or a3))) and (not(a3) or a2)) or a4);
- }
- bool func2(bool a1, bool a2, bool a3, bool a4){
- return(((not(a1) or not(a2 or(not(a3) or a4) and (not(a4) and a3))) or(a3 and(a2 or (not(a3) or a4)and(not(a4) and a3)))));
- }
- bool func3(bool a1, bool a2, bool a3, bool a4){
- return(not(a1) or (not(not(a4) or a3) or a4)and(not(a4) or(not(a2) or a3)));
- }
- bool func4(bool a1, bool a2, bool a3, bool a4){
- return(((not(not(a2) or a3) or a3)and(not(a3) or (not(a1) or a2))) and not(a4));
- }
- bool func5(bool a1, bool a2, bool a3, bool a4){
- return(a1 or (not((not(a2) or not(a3)) and(a3 or a2) ) and (not(a4) or ((not(a2) or not(a3))and( a3 or a2) ) )));
- }
- void input(){
- // input x1
- cout<<"enter 8 digits for x1"<<" ";
- for(int i=0; i<8; i++){
- cin>>x1[i];
- }
- //input x2
- cout<<" "<<"enter 8 digits for x2"<<" ";
- for(int i=0; i<8; i++){
- cin>>x2[i];
- }
- //input x3
- cout<<" "<<"enter 8 digits for x3"<<" ";
- for(int i=0; i<8; i++){
- cin>>x3[i];
- }
- //input x4
- cout<<" "<<"enter 8 digits for x4"<<" ";
- for(int i=0; i<8; i++){
- cin>>x4[i];
- }
- }
- void doFunctions(){
- for (int i=0; i<8; i++){
- res1[i]=func1(x1[i], x2[i], x3[i], x4[i]);
- res2[i]=func2(x1[i], x2[i], x3[i], x4[i]);
- res3[i]=func3(x1[i], x2[i], x3[i], x4[i]);
- res4[i]=func4(x1[i], x2[i], x3[i], x4[i]);
- res5[i]=func5(x1[i], x2[i], x3[i], x4[i]);
- }
- }
- void output(){
- cout<<"function 1"<<endl;
- for(int i=0; i<8; i++){
- if (res1[i]) {cout<<" 1";} else {cout<<" 0";}
- }
- cout<<endl<<"function 2"<<endl;
- for(int i=0; i<8; i++){
- if (res2[i]) {cout<<" 1";} else {cout<<" 0";}
- }
- cout<<endl<<"function 3"<<endl;
- for(int i=0; i<8; i++){
- if (res3[i]) {cout<<" 1";} else {cout<<" 0";}
- }
- cout<<endl<<"function 4"<<endl;
- for(int i=0; i<8; i++){
- if (res4[i]) {cout<<" 1";} else {cout<<" 0";}
- }
- cout<<endl<<"function 5"<<endl;
- for(int i=0; i<8; i++){
- if (res5[i]) {cout<<" 1";} else {cout<<" 0";}
- }
- }
- void pause(){
- cout<<endl<<"input something to exit"<<endl;
- cin>>temp;
- }
- int main()
- {
- input();
- doFunctions();
- output();
- pause();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement