=====
CS 111 - Week 8 Labs - 2024-10-18
=====
=====
TODAY WE WILL:
=====
* announcements/prep for next class
* oh yeah: another C++ compound expression style: parentheses!
* review clicker questions
* Week 8 Lab Exercise
=====
* Watch for class e-mails when Homework 7 is available
=====
C++ and PARENTHESES (really another kind of compound expression!)
=====
* ALSO NOTE:
NOW you can use parentheses more similarly to the way you do in Math!
Another compound expression in C++ is, you can put parentheses around
ANY expression!
3
(3)
((3))
(((((3)))))
(3 + 5)
(3 + 5) * 6
etc.!
* and like in Math's PEMDAS, parentheses let you specify to do one
operation before another --
(3 + 5) * 6 // that is 8 * 6 or 48
3 + (5 * 6) // that is 3 + 30 or 33
* hey, what is 3 + 5 * 6 (if no parentheses?)
C++ decides based on operator precedence!
(I'll link a chart of C++ operator precedence with these notes!)
* does have higher precedence than +,
so 3 + 5 * 6 will have the value 33,
BUT when in doubt, use parentheses to make this clear to
you AND all future readers!!!