**Chapter 5 Margin Notes**

**General Note: A bunch of
Math.**

Page 170. Straight line programs, right now, are the only types of programs you know how to write :)

Page 171. Check out Table 5.1---note the symbol for Multiplication, Division and Modulus.

Page 171. Note the impact of dividing two integers, two floating point numbers and one integer and one floating point number--this may be significant to you when you do your homework assignment for this week.

Page 171. The Modulus operation returns the remainder of a division operation. For instance, 11 divided by 3 is 3 with a remainder of 2. 2 is the result of the Modulus operation.

Page 171. Note that you can't perform a Modulus operation with floating point numbers.

Page 171. When you study Example 5.1, bear in mind that operations are performed on pairs of operands (the numbers to the left and right of the operator). For instance, the second Example 4 * 5 - 10 is actually two operations. Think of it in these terms, and you won't get as confused :)

Page 172. When you have more than one operation being performed in an expression, the computer needs rules to know which operation to perform first. These are noted on Page 172. In class, I'll mention "Please Excuse My Dear Aunt Sally"

Please (Parentheses)

Excuse (Eponentiation)

My (Multiplication)

Dear (Division)

Aunt (Addition)

Sally (Subtraction)

You don't need to worry about exponentiation--as C++ does not have an exponentiation operator.

Page 173. I know I've mentioned it before, but please check out the Debugging Tip.

Page 174. Check out the Debugging Tip---you must have equal numbers of left and right parentheses in your program.

Page 174. C++ has an Increment (++1 operator and a Decrement (--) Operator. The Increment Operator adds 1 to a variable. The Decrement Operator subtracts 1 from a variable. That's the easy part. There's also preincrement and postincrement notation, which impacts when the incrementation or decrementation occurs in an expression. Check this out on Page 174 and 175--we'll explore it in more detail in class as a picture is worth a thousand words in this case.

Page 176. Check out the Debugging Tip---it's a good one. Preincrmeent and Postincrement doesn't matter, unless you use it in an expression. you must have equal numbers of left and right parentheses in your program.

Page 177. An assignment operator assigns a value to a variable, but as you can see from Table 5.2, you can combine some operations. For instance, increments and then assigns a value to a variable.

Page 178. Do me a favor and ignore the explanation about algebra on this page. Every author (and instructor) seems to initially feel the need to make this point--and after 20 years of teaching programming, I can tell you it's pointless :)

Page 179. I'm not likely to ask you specifically about these conversion functions--but remember they are there if you need them. Of the ones listed there, you may find tolower() and toupper() very useful.

Page 180. A fun function is the rand() function which generates a random number between 0 and 1. You can use this in game programs, simulation programs (like Stock Market games), etc.

Page 181. Check out the Inventory program starting on Page 181.

Page 184. In case you are checking out the comments, the author uses the word Object---wish he hadn't done that at this point. It's too early!

Page 187. Note the author's note on this page about having to repeat blocks of code four times---a precursor to our chapter on loops.

Page 188, Data Communications Program. It's an interesting program, but please don't spend much time on it.

Page 192, Polar and Rectangular Coordinates. Again, it's an interesting program, but please don't spend much time on it.