Day 14
- Office Hours shift up one hour to 1-3pm tomorrow (Wednesday)
- Dr. Janzen away at conference next week Monday through Wednesday - no class or office hours
- Some email access, but better bet going to tutoring Sunday - Thursday 7-9
- Read Chapter 11
- Lab 7 is due at end of lab today - don't forget survey
- Project 4 is due Monday night - don't forget survey
- Lab Quiz Retake
- Thursday during lab this week
- See a sample solution to the lab quiz using two 1d arrays
- See a sample solution to the lab quiz using one 2d array
- Practice Exercises:
- Write a program that reads a set of scores and names, terminated by -1, then prints the
names in reverse order of the people whose scores were > 50.
- solution
- Write a program that reads a set of home and visitor scores, terminated by -1, then prints
the two scores if they are both divisible by 7 or divisible by 3.
- solution
- Write a program that reads a set of ages and first names, terminated by -1, then prints
the names in reverse order if their age is less than 20 or greater than 80.
- Lecture Topics
- typedef
- rename a datatype with typedef
typedef int Month;
See months.c
struct
typedef struct {
char brand[31];
char modelName[31];
int modelNumber;
double price;
double screenSize[2];
} Phone;
structs create data types so you can:
- declare variables (including arrays of structs)
- pass parameters (by value and by address)
- return structs from functions (unlike arrays, but like built-in data types)
See solution to cars problem done in am class
See uglier solution to cars problem done in am class
See input file for cars problem
See html output file for cars problem
See a sample solution to the lab quiz using an array of structs (preferred)
See a sample solution to the lab quiz using a struct of arrays (not so pretty)