// Mr. Minich
// CMPSC 101
// Ch. 4 Demo Program #2
// January 30, 2000
// Purpose - to illustrate the use of common logical and relational operators.
#include <iostream.h>
int main()
{
int num1 = 0; // used in sample expressions
int num2 = 0; // used in sample expressions
cout << "Relational Operators: ==, >, <, >=, <=, !=" << endl;
cout << "Is num1 equal to num2? Answer: " << (num1 == num2) << endl;
cout << "Is num1 less than num2? Answer: " << (num1 < num2) << endl;
cout << "Is num1 less than or equal to num2? Answer: " << (num1 <= num2) << endl;
cout << "Is num1 not equal to num2? Answer: " << (num1 != num2) << endl;
cout << "Logical Operators: &&, ||, !";
cout << "Are num1 AND num2 both equal to TRUE? Answer: " << (num1 && num2) << endl;
cout << "Is either num1 OR num2 equal to TRUE? Answer: " << (num1 || num2) << endl;
cout << "Is the opposite of num1 equal to TRUE? Answer: " << !num1 << endl;
num1 = 1;
cout << (num1 || (0 && 0 || !1 || 1 && 0 || !!0)) << endl;
// Short-circuit evaluation occurs here.
return 0;
}// end of main