Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <vector>
- using namespace std;
- bool imp(bool a, bool b) {
- return !a || b;
- }
- bool f(bool p, bool q, bool r) {
- bool A = p && (!q) || r;
- bool B = imp(r, !p) && q;
- bool C = imp(A,B);
- bool D = imp(!r, p);
- bool E = C && D;
- return E;
- }
- int main()
- {
- vector <bool> v = {0,1};
- for (bool p: v){
- for (bool q: v){
- for (bool r: v) {
- bool F = f(p,q,r);
- cout << p << ' '<< q << ' '<< r << ' ' << F << "\n";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement