
2.4 Expressions and Arithmetic Operators 67
with the operators in each row. When two or more operators on the same
level appear in the same expression, the order of evaluation is left to right,
except for the assignment operator, which is evaluated right to left.
As we introduce more operators, we’ll add them to the Order of Precedence
chart. The complete chart is provided in Appendix B.
Using Table 2.11 as a guide, let’s recalculate the number of pennies:
int pennies = 2 * 25 + 3 * 10 + 2 * 5;
= 50 + 30 + 10
= 90
As you can see, 90 is the correct number of pennies in two quarters, three
dimes, and two nickels.
We also could have used parentheses to clearly ...