(Latest Revision: 11/05/2001)
Week 10 Notes for CS 1500 -- Fall 2001
Take roll.
Announcements
- We are starting Lab #6 in the last hour of class this
week.
Check what's new in schedule
The for-loop
- Look at 7.01LineNumsFor-Loop.cpp and
7.02CountDownFor-Loop.cpp to get simple examples
of for-loops.
- counting up
/* Exactly what does this loop write? */
for (i=1; i<10; i++) cout << i*i << " " ;
- counting down
/* Exactly what does this loop write? */
for (i=10; i>0; i--) cout << i*i << " " ;
- Declaration of index
/* Exactly what does this loop write? */
for (int j=0; j<20; j++) cout << 2*j+1 << " "
- Tables (c.f. 7.03MakeSquaresFor-Loop.cpp) in this
directory (Look at the program, try to figure out
what it writes, then check the output given.)
- Look at 7.05MultipTable.cpp as an example of a
program that uses nested for-loops to generate a
rectangular pattern of data.
- 2D-Tables (c.f. payment.cpp in this directory)
(Look at the program, try to figure out what it
writes, then check the output given. Note: the
savings on long-term loans are pretty
interesting.)
-