// Mr. Minich
// CMPSC 101
// Ch. 1 Demo Program #4
// January 30, 2000
// Purpose - to illustrate declaration and assignment statements.
#include <iostream>
using namespace std;
int main()
{
int num1 = 1; // this statement declares AND initializes num1
int num2, num3; // this statement only declares num2 & num3. While the use
// of the comma is syntactically legal, I prefer that
// student's declare separate variables with
// separate declaration statements.
num2 = 400; // assigning 400 to num2 with an assignment statement.
// This is NOT a declaration or initialization statement.
num3 = num2; // assigning value of num2 to num3
num1 = num2 + 3 * num3; // C++ evaluates the multiplication before the addition
cout << "num1 = " << num1 << endl;
// the line above prints "num1 = 1600"
cout << "num2 = " << num1 * 2 << endl;
// the line above prints "num2 = 3200" but does not
// actually change the assigned value of num2 to 3200
cout << "num2 = " << num2 << endl;
// the line above prints "num2 = 400"
return 0;
}// end of main