Lecture Summaries - Week 3
Jump To:
[Lecture Index |
Previous Week's Lectures |
Next Week's Lectures]
Topics covered:
- Developing a program to produce a box of stars.
- How to write a single star.
- How to write a line of stars.
- How to write a multiple lines of stars.
- The program itself
(stars1.c).
- How to rewrite counting while loops as more
compact for loops.
- Redoing the stars program to use for loops
(stars2.c).
- How to hand-execute programs (the "boxes" model).
- How to read an input value with scanf.
- Extending the stars program to perform input with scanf
(stars3.c).
- What happens when the user enters unexpected values
when we use scanf.
Reading: Chapter 2.2, 2.3 (pages 22-26).
Topics covered:
- Rewriting counting loops as for loops revisited.
- Redoing our interest rate program with a for loop
(intrate2.c, page 24).
- Input with scanf revisited.
- Redoing our interest rate program to read input
(intrate3.c, page 26).
- How scanf reads input and returns a value.
- How to save function return values into variables.
- An example program that display's scanf's return value
(inputex.c).
- The idea of an input-reading loop.
- An input reading loop to echo all input values
(inputecho.c).
- An input reading loop that counts the number of inputs
(inputcount.c).
Reading: (no new reading for this lecture).
Topics covered:
- The basic if statement.
- The relational operators.
- How to use if to control a program's output.
A simple program to assign a pass/fail grade
(grade.c).
- How to use if to control calculations.
- A cost-computing program that calculates the discount rate
(discount1.c).
- How to use multiple if statements.
- Extending our cost-computing program to calculate a more complex
discount rate
(discount2.c).
- How to use if to detect input errors.
- Combining if and scanf to detect input errors
(oneinput.c).
- if statements do not require elses.
Reading: Chapter 2.4 (pages 27 and 28).
[EE150 Home Page |
Top Of Page]