#include #include using namespace std; const size_t COL_WIDTH{10}; void PrintLine(bool a, bool b, bool result1, bool result2); int main() { cout << a << endl; bool a{true}, b{false}; cout << boolalpha; cout << "AND table " << endl; cout << setw(COL_WIDTH) << "a" << setw(COL_WIDTH) << "b" << setw(COL_WIDTH) << "a and b" << setw(COL_WIDTH) << "a && b" << endl; a = false; b = false; PrintLine(a,b, a and b, a && b); b = true; PrintLine(a,b, a and b, a && b ); a = true; b = false; PrintLine(a,b, a and b, a && b ); b = true; PrintLine(a,b, a and b, a && b ); cout << endl << endl; cout << "OR table " << endl; cout << setw(COL_WIDTH) << "a" << setw(COL_WIDTH) << "b" << setw(COL_WIDTH) << "a or b" << setw(COL_WIDTH) << "a || b" << endl; a = false; b = false; PrintLine(a,b, a or b, a || b); b = true; PrintLine(a,b, a or b, a || b); a = true; b = false; PrintLine(a,b, a or b, a || b); b = true; PrintLine(a,b, a or b, a || b); cout << endl << endl; cout << "Not Table" << endl; cout << setw(COL_WIDTH) <<"a" << setw(COL_WIDTH) << "not a" << setw(COL_WIDTH) << "!a" << endl; a = false; cout << setw(COL_WIDTH) << a << setw(COL_WIDTH) << not a << setw(COL_WIDTH) << !a << endl; a = true; cout << setw(COL_WIDTH) << a << setw(COL_WIDTH) << not a << setw(COL_WIDTH) << !a << endl; cout << endl; return 0; } void PrintLine(bool a, bool b, bool result1, bool result2){ cout << setw(COL_WIDTH) << a << setw(COL_WIDTH) << b << setw(COL_WIDTH) << result1 << setw(COL_WIDTH) << result2 << endl; return; }