Homework 30: Struct composition
Name: _____________________________________________ Alpha: ___________________
Describe help received: ________________________________________________________
- Due before class on Monday, April 10
- This homework contains code to be submitted electronically.
Put your code in a folder called
hw30
and submit using the204sub
command. - This is an electronic homework and you do not need to print out anything to turn in during class.
Assignment
- Required reading: Sections 5 (Sorting structs) and 6 (composition of structs) from the Unit 8 notes.
-
First download the partially-complete
program
bdays.c
from this link. This is a program to read in people's names and birthdays and then print them out in order from youngest to oldest. Most of the program has been written for you, including twostruct
definitions, two useful functions, and themain
function. All you should change is to fill in the definitions of functionsbefore
andwrite_person
.Example runs:
roche@ubuntu$
./bdays
How many people?
3
Bob 7/28/1991
Lisa 2/13/1988
Mary 1/1/2003
From youngest to oldest:
Mary 1/1/2003
Bob 7/28/1991
Lisa 2/13/1988
roche@ubuntu$
./bdays
How many people?
4
Susan 6/13/1993
Elijah 6/18/1993
Anne 2/18/1993
Cecil 8/3/1992
From youngest to oldest:
Elijah 6/18/1993
Susan 6/13/1993
Anne 2/18/1993
Cecil 8/3/1992