Unit III: Functions
Lecture notes
- Notes for class III.1: Functions
- There are no notes for class III.2.
- Notes for class III.3: Call-by-reference
- Notes for class III.4: Headers, the math library and formatted output.
Sample Programs
- Here's a sample program that
demonstrates some functions.
- Here's scribbler.zip, the
code that I gave you with labIII.2 where we used the Scribbler.
- swap.cpp is an example of using
reference parameters.
- Here's dolly.cpp, which gives some
examples of formatted text.
- Here's precision.cpp, which
gives some other examples of formatted text.
Lab exercises
Reading
This unit is on functions (which in C++ are also called "methods").
Chapter 4 of the textbook talks about functions. You should read
this. (This doesn't cover reference parameters, since the textbook
doesn't talk about those until it covers pointers in Chapter 6)