EEN218 (Programming 2) Spring 2004
- Downloads: Software to make things work
- The book
- Guide to using stdio for input and output
- Review of Recursion, An animation of some recursive functions.
- Introduction to Web-based programming with CGI.
- How to Time a Running Program (Improved, accurate version, 18th Sept 2003).
- Prerequisites test: Tuesday 27th January.
- Mid-Terms: To Be Announced.
- Final Examination on Tuesday 11th May, 11:00 am.
- IMPORTANT: Set up mail forwarding.
- Assignments:
- Due Tuesday 10th February: Pick any TWO of the intermediate (two-digit) problems on
the Automatic Judging site, and solve them.
As this is the first assignment, you will be allowed to resubmit after you get some
feedback on your solutions.
- Due One Week After you get comments back on the first assignment: Improve your first
assignment by taking the grader's comments into account. Note: you do not normally get
a second turn-in for an assignment; this is just because it is the first one.
- Due Thursday 26th February.
(Full Description Here)
Read a database of people into an array in memory. Answer simple queries from the user.
One type of query should be search; one type of query should be sort (by birthdate, etc)
and show first 20. Database files for download:
500 people,
1000 people,
1500 people,
2000 people,
2500 people,
3000 people,
3500 people,
4000 people,
4500 people,
5000 people,
6000 people,
7000 people,
8000 people,
9000 people,
10000 people. If using rabbit, no need to download;
just access the files called "/data/people-2000.txt", etc.
- Due Tuesday 23rd March.
Exactly the same as the previous assignment, BUT you must
store your database in a linked list, NOT an array or vector.
- Due Thursday 1st April.
An extension of the previous assignment, with additional requirements. You must produce
a user-friendly interactive system (see full description here),
must use linked lists, and must produce a clear and understandable program, avoiding
unnecessarily repeated code.
- Due Thursday 8th April.
An extension of the previous assignment, with additional requirements.
(see full description here). The additional requirement is that
the user must be able to issue a "sort" command, and the system should not only
sort the database, but also report the amount of time that operation took.
- Due Thursday 22nd April.
Game program as described in class; initial turn-in with basic functionality. Follow these links
to see a Sample Run or a Sample Map File.
Your program does not need to duplicate the behaviour of these samples; they are just to provide
some guidance to what is expected. Look here for a reminder of
the Basic Requirements.
- Due Thursday 6th May.
Final version of game program.
- Class History:
- Class 1 (20-1-2004) General introductions; what the class is about.
- Class 2 (22-1-2004) Preparation for the prerequisites test.
- Class 3 (27-1-2004) The prerequisites test.
- Class 4 (29-1-2004) Using the automatic judge; char, short int, int, long int, long long int, and unsigned.
- Class 5 (3-2-2004) Accuracy, implementing fractions, good program design with obvious functions; towards objects.
- Class 6 (5-2-2004) (today's notes: fractions)
Implementing fractions; the need for 'valid' flags; functions with many parameters; a struct.
- Class 7 (10-2-2004) (today's notes: manipulators, printf)
Complicated output: i/o manipulators, using printf instead.
- Class 8 (12-2-2004) (today's notes: getchar) Handling input for automatic judge problems; Using getchar for input.
- Class 9 (17-2-2004) (today's notes: objects) Many examples of useful structs; nested structs; input and output functions for them.
- Class 10 (19-2-2004) Using argc and argv; approximate equality; assuming ASCII.
- Class 11 (24-2-2004) Using pointers to objects: benefits (memory use, consistent shared objects), declarations, using new to create.
- Class 12 (26-2-2004) Memory layout: code, globals, heap, and stack; segmentation faults, uninitialised pointers, and array overruns.
- Class 13 (2-3-2004) Accessing objects with and without pointers: potential problems; defining new operators for objects and iostreams.
- Class 14 (4-3-2004) Mid-Term Exam Today (Subject List Here).
- Class 15 (9-3-2004) When arrays aren't good enough; the right way to build and use linked lists.
- Class 16 (11-3-2004) Heavy review of linked list methods with careful diagrams.
- Class 17 (23-3-2004) Important correspondence between real world objects and program objects; linked list with link and list structs; adding to end of list; removing from list.
- Class 18 (25-3-2004) About database assignments; Top down design of a sorting algorithm; Making linked lists look like arrays.
- Class 19 (30-3-2004) Formal analysis of a sorting algorithm to deduce speed.
- Class 20 (1-4-2004) Finishing analysis of sorting algorithm; what O(...) really means; camparing common algorithms for speed.
- Class 21 (6-4-2004) Accurately timing a program; Logarithmic algorithms: binary chop search, to-the-power-of; exponential algorithms.
- Class 22 (8-4-2004) About the game project, handling the map effectively; Introducing vectors and trees.
- Class 23 (13-4-2004) Merge is easy and O(n); Merge-Sort, algorithm, time O(nlogn), on arrays requires twice the memory; merge-sort on linked lists; extending to trees.
- Class 24 (15-4-2004) Test topic reminders; linked list operations; more timing; matrix multiplication; O()+experiment=real time.
- Class 25 (20-4-2004) Mid-Term Exam Today (solutions html or word).
- Class 26 (22-4-2004) Arrays and functions are constants; complex declarations, pointers to arrays and functions; application to FlexArrays (vectors).
- Class 27 (27-4-2004) Normal use of "class" vs "struct"; methods; public, protected, and private; constructors and destructors.
- Class 28 (29-4-2004) The differences between C and C++: no class/public-protected/constructor-destructor; no string (use array of char); no reference (use pointers); no overloading; no operator definition; no cin/cout (use printf/getchar/...); no new/delete (use malloc/free).