// Author: Keith Shomper // Date: 9/22/03 // Purpose: To demonstrate the bool type and logical expressions #include using namespace std; int main() { // Show the representation for 'true' and 'false' cout << "true is = " << true << endl; cout << "false = " << false << endl; // Initialize the variables to known values bool p = true, q = false; int i = 5, j = 9; // Show how the values are evaluated cout << "p = " << p << endl; cout << "q = " << q << endl; cout << "!p = " << !p << endl; cout << "!q = " << !q << endl; cout << "p && q = " << (p && q) << endl; cout << "p || q = " << (p || q) << endl; cout << "p && !q = " << (p && !q) << endl; cout << (i < j) << endl; cout << (i == j) << endl; cout << (i = j) << endl; return 0; }