Advertisement
Korotkodul

mlta

Sep 25th, 2023
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <vector>
  11. using namespace std;
  12.  
  13.  
  14. bool imp(bool a, bool b) {
  15.     return !a || b;
  16. }
  17.  
  18.  
  19.  
  20. bool f(bool p, bool q, bool r) {
  21.     bool A = p && (!q) || r;
  22.     bool B = imp(r, !p) && q;
  23.     bool C = imp(A,B);
  24.     bool D = imp(!r, p);
  25.     bool E = C && D;
  26.     return E;
  27. }
  28.  
  29. int main()
  30. {
  31.     vector <bool> v = {0,1};
  32.     for (bool p: v){
  33.         for (bool q: v){
  34.             for (bool r: v) {
  35.                 bool F = f(p,q,r);
  36.                 cout << p << ' '<< q << ' '<< r << ' ' << F << "\n";
  37.             }
  38.         }
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement