Code
This page simply collects example code in one place, most of it comes from specific lectures as indicated here and on the Schedule.
Week 1
- Lecture 1: hello.c arguments.c Makefile (for lectures 1-3)
- Lecture 2: data.c
- Lecture 3: control.c
Week 2
- Lecture 4: cat.c wc.c functions.c Makefile (for lecture 4, 6 and section)
- Lecture 5: link.tar.gz
- Lecture 6: arrays.c rpn.c stack.h stack.c
- Section Week 2: grep.c
Week 3
- Lecture 7/8: pointers.c Makefile (for lectures 7-9)
- Lecture 8: tol.c memory.c
- Lecture 9: files.c format.c
- Section Week 3: caesar.c
Week 4
- Lecture 10: structs.c Makefile (for lectures 10-11)
- Lecture 11: sizeof.c malloc.c lists.c
- Lecture 12: one-stack.tar.gz many-stacks.tar.gz
- Not a Lecture: sdbm-examples.tar.gz
Week 5
- Lecture 13: fp.c Makefile (for lectures 13-15)
- Lecture 14: enum.c macros.c args.c
- Lecture 15: objects.c (new this semester) oldobj.c (from last year)
- Not a Lecture: inherit.c (new this semester) Raluca's sdbm-tests.tar.gz from Fall 2006
Week 6
- Lecture 16: message.c xmpl.c Makefile (for lectures 16-17)
- Lecture 17: loop.c timing.c
- Lecture 18: hello.cc namespaces.cc io.cc sum.cc strings.cc structs.cc classes.cc Makefile (for lecture 18)
Week 7
- Lecture 19: counters.cc references.cc arrays.cc Makefile
- Not a Lecture: linked_counter.tar.gz (example for independent compilation)
- Section Week 7: joseph_stack.tar.gz (see also jonathan_stack.tar.gz from Spring 2007 and raluca_stack.tar.gz from Fall 2006)
Week 8
Spring break! I hope you did some coding on your own... :-)
Week 9
- Lecture 22: phf_stack.tar.gz copying.cc
- Lecture 23: Rational.h Rational.cpp TestRational.cpp (from Mark Weiss) int_stack.tar.gz
- Lecture 21: vector_basic.cc vector_iterator.cc (still to come)
- Lecture 24: overload.cc friends.cc templates.cc (still to come)
- Not a Lecture: initialize.cc insane.cc :-) trash.cc :-) mutual.tar.gz
Week 10
- Lecture 23: animals.cc (we did a different example in Spring 2008, but the same concepts) Makefile (for lectures 23-25)
- Lecture 24: casts.cc maps.cc
- Lecture 25: TBD convs.cc (still to come)
If you have comments or questions about any of these code examples, please bring them up in lecture or on the discussion list. Thanks!
Junk
The code below is not available yet, and in fact it may never be. It's mostly "leftovers" from the previous offering of the course.
- Section Week 3: newcat.c
- Not a Lecture either: stack.tar.gz (updated 2006/10/10)
- Lecture 13/14: perf.tar.gz
- Lecture 19/20: int_stack.tar.gz references.cc
- Lecture 21: templates.cc working_stack.tar.gz
- Lecture 22: overload.cc
- Lecture 23: map.cc
- Lecture 23/24: animals.cc
- Not a Lecture either: netsim.tar.gz
- Random Test Cases for Network Simulation: generated-networks.tar.gz
- Lecture 25: const.cc casts.cc
- Lecture 29: exceptions.cc
- Not a Lecture either: netsim_two.tar.gz
- Lecture 37: vector2.cc wordfreq.cc
- Lecture 38: anagrams.cc allanagrams.cc
- Lecture 39: hello.py most.py