Week 3 - Defining and Using Functions

Learning Objectives

Upon finishing this learning module, you should be able to:

  • Identify the parameters and return type of functions
  • Trace code involving function calls
  • Use a unit testing framework to test functions

Day 1

  • Turn in assignment 2 if you haven't already
  • Start on Functions (Ch 5.1-5.5)

Day 2

  • Continue Functions (Ch 5.5-5.11)
  • At this point you should be ready to do Ch 5 the exercises

Day 3

  • Testing (Ch 5.12-5.16)
  • Start in on assignment 3.

Day 4


Functions

Work through Chapter 5.1-5.11 of the book.

After you have read 5.11, watch this video to learn how to easily write doxygen comments in VS Code:

Important Video

Testing

Read Ch 5.12-5.16 about testing and watch these videos:

For how to do this in a Codespace, watch the following video:

Important Video

These two pages are a reference for using the Unit Testing framework. Use them if you quickly review how to use Doctest:


Debugger Practice

Watch this video on using the debugger to step through code that uses functions:

Important Video

Then try the Debugger Practice activity linked in Module 3 of the course.


Setting Up a Local Development Environment

You can get through this course just fine using Codespaces.

If you are only taking CS161 (Cybersecurity), you likely don't need to worry about setting up a local environment.

If you are going to continue to CS162 (CS and Engineers), you will eventually want to set up a local environment. So give that a try now. If everything works perfectly, great, you can start using that environment. If you run into problems, you can always fall back to using Codespaces while you get your local environment set up.

To work locally, you will need to install a code editor (VS Code), a compiler (g++), and Git. Follow the instructions in this guide to set everything up:

VS Code and Compiler Setup

Then refer to this guide to learn how to get one of the project templates set up locally:

Local Development Guide