Last active
September 30, 2025 11:17
-
-
Save juanfal/35f5cea92fa0005cbb4fa815f35032eb to your computer and use it in GitHub Desktop.
de Morgan's laws 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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