Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void combination(bool A, bool B, bool C) {
- if( (A && B ) || (A && C))
- cout<< boolalpha << "("<< A <<" and " <<B <<") or ("<< A << " and "<<C<<") combination is true" <<endl;
- if( (A && C ) && (B && C))
- cout<< "("<< A <<" and " <<C <<") and ("<< B << " and "<<C<<") combination is true" <<endl;
- if( (A || B ) && !(B || C))
- cout<< "("<< A <<" or " <<B <<") and !("<< B << " or "<<C<<") combination is true"<< endl;
- if( (A || (B && C) ) && (!A && !B))
- cout<< "("<< A <<" or (" <<B <<" and "<< C <<")) and (!"<< A << " and !"<<B<<") combination is true" <<endl;
- if( ((B && C ) || (C && A)) && (!(A || B) && C))
- cout << "(( "<<B <<" and "<<C<<") or ("<<C<<" and "<<A <<")) and (!("<<A <<" or "<<B<<") and "<<C<<") combination is true" <<endl;
- }
- int main() {
- combination(true, true, true);
- combination(true, true, false);
- combination(true, false, false);
- combination(true, false, true);
- combination(false, true, true);
- combination(false, true, false);
- combination(false, false, false);
- combination(false, false, true);
- return 0;
- }
Add Comment
Please, Sign In to add comment