CS 110B Programming Fundamentals: C++

Lesson 14: Structs

I don't have extensive notes for this lesson, but I have an example program that uses structs to store [imaginary] information about famous people. The program just reads and stores the information in from a file named "famous.dat" and then prints the information back out again. You can imagine that the program could be quite complex if we wanted to make it so. For example, we could allow the user to ask things like, "What is the last name of the person with id 32?"

I suggest you spend a good chunk of time looking the code over and making sure that you understand everything that is going on.

Here is the famous people example.

Here is the data file "famous.dat" that you'll need.