Skip to content

Instantly share code, notes, and snippets.

@juanfal
Last active September 30, 2025 11:17
Show Gist options
  • Save juanfal/35f5cea92fa0005cbb4fa815f35032eb to your computer and use it in GitHub Desktop.
Save juanfal/35f5cea92fa0005cbb4fa815f35032eb to your computer and use it in GitHub Desktop.
de Morgan's laws 1
// 04.demorgan1.cpp
// juanfc 2025-09-30
// https://gist.github.com/juanfal/35f5cea92fa0005cbb4fa815f35032eb
#include <iostream>
using namespace std;
int main()
{
int x, y;
cout << boolalpha; // to print all bools as true/false
cout << "Enter 2 integers: ";
cin >> x >> y;
cout << "not ( " << x << " < " << y << " and " << y << " > 5) -> ";
cout << (not ( x < y and y > 5)) << endl;
cout << "not ( " << x << " < " << y << " ) or not ( " << y << " > 5) -> ";
cout << (not ( x < y ) or not (y > 5) ) << endl;
cout << x << " >= " << y << " or " << y << " <= 5) -> ";
cout << ( x >= y or y <= 5) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment