Skip to content

Instantly share code, notes, and snippets.

@juanfal
Created September 30, 2025 11:18
Show Gist options
  • Save juanfal/76566c2a8b53e55d478f837467f9a3ae to your computer and use it in GitHub Desktop.
Save juanfal/76566c2a8b53e55d478f837467f9a3ae to your computer and use it in GitHub Desktop.
de morgan 2
// 05.demorgan2.cpp
// juanfc 2025-09-30
//
#include <iostream>
using namespace std;
int main()
{
cout << boolalpha;
const int A = 2; // we don't need them global
const int B = 3;
const int C = 2;
bool found = false;
cout << "not ( ( " << found << " and ( " << A << " == " << B << " )) or ( " << A << " == " << C << " ) ) -> ";
cout << boolalpha << (not ( (found and (A == B)) or (A == C) )) << endl;
cout << "not ( " << found << " and ( " << A << " == " << B << " )) and not ( " << A << " == " << C << " ) -> ";
cout << boolalpha << (( not (found and (A == B)) and not (A == C) )) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment