Skip to content

Instantly share code, notes, and snippets.

@juanfal
Created September 30, 2025 10:40
Show Gist options
  • Save juanfal/ef25f6205851e1351f35cbc000fa055b to your computer and use it in GitHub Desktop.
Save juanfal/ef25f6205851e1351f35cbc000fa055b to your computer and use it in GitHub Desktop.
booleans!
// 01.booleans.cpp
// juanfc 2025-09-24
//
#include <iostream>
using namespace std;
int main()
{
cout << "true and true -> " << (true and true) << endl;
cout << "false and true -> " << (false and true) << endl;
cout << "1 == 1 and 2 == 1 -> " << (1 == 1 and 2 == 1) << endl;
cout << "1 == 1 or 2 != 1 -> " << (1 == 1 or 2 != 1) << endl;
cout << "true and 1 == 1 -> " << (true and 1 == 1) << endl;
cout << "1 != 0 and 2 == 1 -> " << (1 != 0 and 2 == 1) << endl;
cout << "not (true and false) -> " << (not (true and false)) << endl;
cout << "not (1 == 1 and 0 != 1) -> " << (not (1 == 1 and 0 != 1)) << endl;
cout << "not (10 == 1 or 100 == 100) -> " << (not (10 == 1 or 100 == 100)) << endl;
cout << "not (1 != 10 or 3 == 4) -> " << (not (1 != 10 or 3 == 4)) << endl;
cout << "1 == 1 and not (1 == 1 or 1 == 0) -> " << (1 == 1 and not (1 == 1 or 1 == 0)) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment