Week 9 - Defining Types (Enums, Typedef, and Structs)

Learning objectives

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

  • Design and write code using multidimensional arrays
  • Use structs to represent heterogeneous collections of data

Schedule

Day 1

Day 2

Day 3

Day 4

  • Structs and Arrays
  • Check out final assignment. Pick a data file and clean it up. Start writing code to parse the data.

Activity Outline

This week we are hitting some topics that are not covered in the regular part of the book. It is more important than usual that you check out the code samples from the files area in elearn

Multidimensional Arrays

Read Ch 8.1-8.4
This video has some background on why 2D arrays behave the way they do and how to use the debugger on them in QtCreator:

Do the CPP Lab Multidimensional Arrays.

Read Ch 8.5-8.8.1. Focus on the ideas of each program and how they use 2D arrays. Don't try to memorize the details.

This video talks through some of the interesting things in the sample programs from those sections, as well as some things that could be improved in them.

Structs

Read learncpp.com's struct page

These videos cover structs and introduce some concepts that are not covered in the reading. This first one should be enough to prepare you for the CPPLab.

Do Structs CPP Lab

Structs and Arrays

This video demonstrates managing more complex data by combining structs and arrays. It will help get you ready for the last assignment.