Lecture Summaries - Week 8
Jump To:
[Lecture Index |
Previous Week's Lectures |
Next Week's Lectures]
Topics covered:
- Why programming languages provide more than one way of doing
things.
- Why we have shortcut operators.
- The shortcut arithmetic operators.
- The prefix and postfix increment and decrement operators.
- What happens when we use these operators inside another expression.
- Counting from 1 to 10 using postfix increment
(count1.c).
- Counting from 1 to 10 using prefix increment
(count2.c).
- The "blastoff" program
(blastoff.c).
- The conditional operator.
- Multiple assignments in one expression.
- An example of the use of shortcut operators.
- An input-averaging program without shortcuts
(avg2.c, page 119).
Topics covered:
- What the three different types of if statements are.
- How the else-if works.
- Writing an if-else as a series of nested ifs
(grade1.c).
- Writing an if-else as a series of else-ifs
(grade2.c).
- There are always different ways to make the same decision.
- One way to write an if-else to assign letter grades,
including plus and minus
(grade3.c).
- Another way to write ifs to assign letter grades
(grade4.c).
- The ambiguous if problem.
- How to use switch to select an action based on specific
value of variables.
- An example of a selection based on an else-if
(gpa1.c).
- An example of a selection based on an switch
(gpa2.c).
- Some crucial details about using switch.
Reading: Chapter 6.1, 6.2, and 6.3.
Topics covered:
- Incremental program development.
- An example with a checkbook balancing program.
- Start small. We just read/echo transactions
(cb1.c).
- Test and fix all bugs before moving on. We have to read the
newline following the transaction code
(cb2.c).
- Add one simple piece of functionality add a time. We add
printing the balance
(cb3.c).
- Do a more complex only after you are sure of the simple piece.
We add handling a service charge
(cb4.c).
- Do similar/related actions after the similar action works.
We add handling checks, withdrawals, and deposits
(cb5.c).
- Again, add one simple piece of functionality. We add
totalling the deposits
(cb6.c).
- Again, do similar related actions after the similar action
works. We add totalling checks, withdrawals, and service
charges (cb7.c).
- Do the fancy stuff last! We identify 0-count transactions
and print average amounts
(cb8.c).
Reading: (No new reading for this lecture).
[EE150 Home Page |
Top Of Page]