// Mr. Minich
// CMPSC 201
// Ch. 4 Demo Program #1
// January 30, 2000
// Purpose - to illustrate how C++ treats arithmetic and Boolean expressions. The program also illustrate
// the use of a couple relational and logical operators.
#include <iostream.h>
int main()
{
int num1 = 0;
// used in expressions that illustrate the use of assigment and logical and relational expressions
cout << "num1 equals " << num1 << endl;
// This prints "num1 equals 0"
cout << "num1 equals " << (num1 = 3) << endl;
// This prints "num1 equals 3" because C++ performs the assignment of the value 3
// to the variable num1 and prints its value. This line of code could easily be
// split over 2 lines of code of course such as,
// num1 = 3;
// cout << "num1 equals " << num1 << endl;
cout << "num1 equals " << (num1 == 3) << endl;
// This prints "num1 equals 1" because the result of the expression (num1 == 3)
// is TRUE, which is equivalent to the value of 1 according to C++. The double
// equals (==) is a relational operator, NOT the C++ assignment operator.
cout << "num1 equals " << (num1 != 3) << endl;
// This prints "num1 equals 0" since the relational expression evaluates to FALSE,
// which is equivalent to the value of 0 according to C++.
return 0;
}// end of main