Day 6
- Reading: Read through Chapter 5
- Lab 4 is due at beginning of lab next Tuesday
- Midterm on April 21
- Covers chapters 1 through 5 in the text (light on 1 and 5)
- Written exam - bring a pencil
- Multiple choice, true/false, fill-in-the-blank
- Trace code (e.g. what does it print?, what do variables contain?)
- Write code segments, functions, tests, and programs
- Study suggestions:
- Read chapters in the book
- Review Chapter Review sections
- Do quick check exercises in book
- Form a study group - teach/explain things to each other
- Keep a vocabulary words list
- Lab Quiz on April 21
- Solve a problem similar to the examples in the lecture notes
- Write a complete program including checkit_* tests
- Pass/fail grade
- Lecture Topics
- constants
#define JAN 1
- kinds of loops - Examples
- counting loops
- Example: write a function that sums ten ints
- sentinel-controlled loops
- Example: write a function that averages ints until the user enters 0
- end-of-file-controlled loops
- Example: write a function that averages all the ints in a file
- input validation loops
- Example: write a function that keeps asking for a valid letter grade (A,B,C,D,F) until
it receives one
- general conditional loops
- Example: write a function that sums ints as long as the sum is below 100
- for loops
- Example: re-write the first two examples above
- do-while loops
- Example: Write a function that repeatedly prompts the user and reads positive numbers until
they enter a negative number. Return the sum of the positive numbers entered.