Week 6: Defining and Using Functions
Learning objectives:
Upon finishing this learning module, you should be able to:- Identify the parameters and return type of functions
- Describe the difference between value and reference parameters
- Trace code involving function calls
- Write programs utilizing functions to decompose a problem
Deadlines This Week:
- Monday - Tuesday in class
- Monday 11:59PM - Assignment 5
- Thurs 11:59PM - Functions Basics CPPLab
- Sat 11:59PM - Functions 2 CPPLab
Classroom Schedule:
- Monday
-
- No class meeting. On your own, watch the first two videos below and do the following.
- Functions
- Read Ch 6.1-6.5
- CPPLabs: Function basics
- Tuesday
-
- Midterm
- Wed
-
- Special Cases and Reference Parameters
- Read Ch 6.6-6.7, 6.9, 6-11.13
- CPPLabs: Functions 2
- Fri
-
- .h/.cpp files
- Building Programs
- Read Ch 6.8, 6.15
Online Activity Outline:
Functions
- Read Ch 6.1-6.6 and watch these videos:
Writing Functions: Functions & Scope: - Do the CPPLab
- Read 6.7, 6.9 and 6.11 - these are all special purpose function tricks. This video talks through them:
- Read 6.12-6.13 and watch these videos on reference parameters.
Reference Parameters Visualizing Reference Parameters - Do the CPPLab Functions 2
- Read 6.8 and
LearnCpp.com Chapter 2.11-2.12 which covers header files (not covered well in the book).
Then watch this video that talks about some other
techniques for building and documenting complex programs an libraries of
functions:
- Finally, read 6.15 and watch this video on how to go about deigning and building programs using functions:
- Do the assignment.
Extra Info:
Learncpp.com
This online tutorial covers some of the same ground as the readings:
LearnCpp.com 7.1 to 7.7 (Can skip 7.6) cover functions
LearnCpp.com 7.1 to 7.7 (Can skip 7.6) cover functions
Classroom slides/examples:
Directory of files from the weekRight click files and save to your computer