Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define X1_REV ((x1+1) % 2)
- #define X2_REV ((x2+1) % 2)
- #define X3_REV ((x3+1) % 2)
- #define Y1_F (x3&X2_REV&x1) || (x3&x2&X1_REV) || (x2 & X1_REV)
- #define Y2_F (X3_REV&X1_REV) || (X3_REV & X2_REV&x1) || (x3&x2&x1)
- bool matrixResultMax[9][11] = {};
- using namespace std;
- bool x1 = 0;
- bool x2 = 0;
- bool x3 = 0;
- bool y1, y2;
- bool y1_f[5];
- bool y2_f[5];
- int tableX[9][3] = {
- {0,0,0},
- {0,0,1},
- {0,1,0},
- {0,1,1},
- {1,0,0},
- {1,0,1},
- {1,1,0},
- {1,1,1}
- };
- void printTable()
- {
- for(int i =0; i<8; i++)
- {
- for(int j =0; j<3;j++)
- {
- cout << tableX[i][j] << " ";
- }
- cout << endl;
- }
- }
- void calc()
- {
- for(int i =0; i<8; i++)
- {
- // -- F0------
- x1 = tableX[i][2];
- x2 = tableX[i][1];
- x3 = tableX[i][0];
- bool y1_f0 = Y1_F;
- bool y2_f0 = Y2_F;
- /-----------------------
- // F1 ---------------------------------
- #define x2 0
- bool y1_f1 = Y1_F;
- bool y2_f1 = Y2_F;
- #undef x2
- // -------------------------
- // F2 ---------------------
- bool y1_f2 = Y1_F;
- #undef X3_REV
- #define X3_REV 0
- bool y2_f2 = Y2_F;
- #undef X3_REV
- #define X3_REV ((x3+1) % 2)
- //------------------------------
- // F3 ------------------------
- #define T3_y1 0 || (x3&x2*X1_REV) || (x2 & X1_REV)
- bool y1_f3 = T3_y1;
- bool y2_f3 = Y2_F;
- // --------------------------------------
- // F4 -----------------------
- #define T4_y2 1 || (X3_REV & X2_REV & x1) || (x3&x2&x1)
- bool y1_f4 = Y1_F;
- bool y2_f4 = T4_y2;
- // ----------------------------
- matrixResultMax[i][0] = y1_f0;
- matrixResultMax[i][1] = y2_f0;
- matrixResultMax[i][2] = y1_f1;
- matrixResultMax[i][3] = y2_f1;
- matrixResultMax[i][4] = y1_f2;
- matrixResultMax[i][5] = y2_f2;
- matrixResultMax[i][6] = y1_f3;
- matrixResultMax[i][7] = y2_f3;
- matrixResultMax[i][8] = y1_f4;
- matrixResultMax[i][9] = y2_f4;
- // cout << x3 << x2 << x1 << " |" << y1_f0 << " " <<
- // y2_f0 << " "<< y1_f1 << " " << y2_f1 << " "<< y1_f2 << " " << y2_f2 <<
- // " "<< y1_f3 << " " << y2_f3 <<
- // " "<< y1_f4 << " " << y2_f4 << endl;
- cout << x3 << x2 << x1 << " |" << y1_f3 << " " << y2_f3 << endl;
- }
- }
- void printMatrixResult()
- {
- for(int i =0; i<=8;i++)
- {
- for(int j =0; j < 10; j++)
- {
- cout << matrixResultMax[i][j] << " ";
- }
- cout << endl;
- }
- }
- void printMatrixResultFormated()
- {
- for(int i =0; i<8;i++)
- {
- for(int j =0; j <10;)
- {
- cout << matrixResultMax[i][j] << " ";
- j+=2;
- }
- cout << endl;
- for(int k =1; k <10;)
- {
- cout << matrixResultMax[i][k] << " ";
- k+=2;
- }
- cout << endl;
- cout << endl;
- }
- }
- int main()
- {
- calc();
- printMatrixResult();
- cout << "y1: " << endl;
- printMatrixResultFormated();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement