Print this homework sheet, bring it to the class, and turn it in right before the next lecture starts.
expression | evaluated as | due to |
x + y * z | (x + y) * z OR x + (y * z) | precedence OR associativity |
x > y + z | (x > y) + z OR x > (y + z) | precedence OR associativity |
cin >> x >> y | (cin >> x) >> y OR cin >> (x >> y) | precedence OR associativity |
x = y = 1 | (x = y) = 1 OR x = (y = 1) | precedence OR associativity |
x = y == z | (x = y) == z OR x = (y==z) | precedence OR associativity |
int n = 5;
double x = 10.5;
char c = 'R';
Fill in the table on the right. 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.
|
|
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 |
$ ./hw Enter year: 703 Is Not Leap Year $ ./hw Enter year: 704 Is Leap YearSubmit
~/bin/submit -c=IC210 -p=hw07 hw.cppTurn in a printout of this cover sheet and the codeprint of hw.cpp