Advertisement
193030

temp_code

Feb 13th, 2022
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.74 KB | None | 0 0
  1. #include <iostream>
  2. #define X1_REV  ((x1+1) % 2)
  3. #define X2_REV ((x2+1) % 2)
  4. #define X3_REV ((x3+1) % 2)
  5.  
  6. #define Y1_F (x1 & x2) || (X1_REV & X2_REV) || (x1&x2&x3) || (X1_REV&X2_REV&X3_REV)
  7. #define Y2_F (x1 & x2 & x3)
  8.  
  9.  
  10.  
  11. using namespace std;
  12.  
  13. bool x1 = 0;
  14. bool x2 = 0;
  15. bool x3 = 0;
  16. bool y1, y2;
  17. bool y1_f[5];
  18. bool y2_f[5];
  19.  
  20.  
  21. int tableX[9][3] = {
  22.     {0,0,0},
  23.     {0,0,1},
  24.     {0,1,0},
  25.     {0,1,1},
  26.     {1,0,0},
  27.     {1,0,1},
  28.     {1,1,0},
  29.     {1,1,1}
  30. };
  31.  
  32. void printTable()
  33. {
  34.     for(int i =0; i<8; i++)
  35.     {
  36.         for(int j =0; j<3;j++)
  37.         {
  38.             cout << tableX[i][j] << " ";
  39.  
  40.         }
  41.         cout << endl;
  42.     }
  43. }
  44.  
  45. void calc()
  46. {
  47.  
  48.     for(int i =0; i<8; i++)
  49.     {
  50.         x1 = tableX[i][2];
  51.         x2 = tableX[i][1];
  52.         x3 = tableX[i][0];
  53.         bool y1_f0 = Y1_F;
  54.         bool y2_f0 = Y2_F;
  55.  
  56.         #define x1 1
  57.             bool y1_f1 = Y1_F;
  58.             bool y2_f1 = Y2_F;
  59.         #undef x1
  60.  
  61.         bool y1_f2 = Y1_F;
  62.         #define x3 1
  63.             bool y2_f2 = Y2_F;
  64.         #undef x3
  65.  
  66.          #define X3_REV 0
  67.             bool y1_f3 = Y1_F;
  68.             bool y2_f3 = Y2_F;
  69.         #undef X3_REV
  70.  
  71.          #define Y1_NEW (x1 & x2) || (X1_REV & X2_REV) || (x1&x2&x3) || 1
  72.             bool y1_f4 = Y1_NEW;
  73.             bool y2_f4 = Y2_F;
  74.         #undef Y1_NEW
  75.  
  76.         cout << x3 << x2 << x1 << "   |" << y1_f0  << " " <<
  77.          y2_f0 << " "<< y1_f1 << " " << y2_f1 << " "<< y1_f2 << " " << y2_f2 <<
  78.          " "<< y1_f3 << " " << y2_f3 <<
  79.          " "<< y1_f4 << " " << y2_f4 <<        endl;
  80.         //y1 = functionY1();
  81.        // y2 = functionY2();
  82.        // cout << x1 << x2 << x3 << "   |" << y1 << " " << y2<<endl;
  83.     }
  84.  
  85.  
  86. }
  87. int main()
  88. {
  89.     calc();
  90.  
  91.  
  92. }
  93.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement