Name: ____________________________________________________ Alpha: _____________________

For this assignment you will want to consult the C++ operator associativity/precedence table.

1. [10pts] For each of the below, circle the correctly parenthesized version of the expression and circle "precedence" or "associativity" as appropriate.

1. x + y * z evaluates as (x + y) * z OR x + (y * z) due to: precedence associativity
2. x > y + z evaluates as (x > y) + z OR x > (y + z) due to: precedence associativity
3. cin >> x >> y evaluates as (cin >> x) >> y OR cin >> (x >> y) due to: precedence associativity
4. x = y = 1 evaluates as (x = y) = 1 OR x = (y = 1) due to: precedence associativity
5. cin >> x = y evaluates as (cin >> x) = y OR cin >> (x = y) due to: precedence associativity
2. [10pts] Assume the following delcarations fill in the table. New Note: each expression should be taken as independent. I.e. if one expression modifies some variable values, those modifications do not carry over to the next expression.
```int n = 5;
double x = 1.5;
char c = 'R';
```
 expression type value `n = 2` `n == 2` `c < 200` `1 != x` `n*x`
3. [5pts] Explain why `1 < x < 10` always returns true no matter what x is.
4. [75pts] A year is a leap year if it is evenly divisible by 4, Except that years that are evenly divisible by 100 are not leap years unless they are evenly divisible by 400. Clear? For example:
 Year divisible by 4? divisible by 100? divisible by 400? Is leap year? 703 no no no not leap year 704 yes no no leap year 700 yes yes no not leap year 800 yes yes yes leap year
Write a program that reads a year and prints out (correctly!) Is Leap Year or Is Not Leap Year. Here are two example runs.
```\$ ./hw
Enter year: 703
Is Not Leap Year
\$ ./hw
Enter year: 704
Is Leap Year```

Important: For those of you who already know about &&, || or !, do not use them!

Turn in a printout of this cover sheet with your answers to the questions, your source code, and a screen capture of your program running each of the four examples from the table above.