Lecture 13: Loops 3
Thursday, October 13, 2011 Status: complete[Up] [Previous Lecture] [Next Lecture]
Powerpoint Slides: none
Reading Assigned: 5.7
Homework Due:
Homework Assigned:
Topics Covered:
- for loops
- increment and decrement operators: ++, --
- shortcut assignment operators: +=, -=, ...
- Classwork 13.
Programs Shown:
- Simple uses of a for loop: for1.c, for2.c and for3.c.
- Don't use a for loop with floating point variables as the control: beer.c.
- Using the increment and decrement operators (++, --) and the shortcut assignment operators (+=, -=, ...): ops1.c, ops2.c and ops3.c.
- Revisiting the inchworm from
Classwork 5.
Here's the original program to eat a food pellet: eat.c.
We should really use some loops here: inch1.c, inch2.c, inch3.c and inch4.c.