EEN218 (Programming 2) Spring 2005
- Downloads: Software to make things work
- The book
- Review of Recursion, An animation of some recursive functions.
- For Reference:
- Introduction to Web-based programming with CGI.
- How to Time a Running Program (Improved, accurate version, 18th Sept 2003).
- CGI programs can be Sampled Here; you can't see
the C++ code, but you can get sample runs, and use "view source" to see how the HTML
formatting was done.
- Examinations:
- Prerequisites test: Tuesday 25th January.
- Mid-Term Examination: Thursday 24h March.
- End-Term Examination: Return to me IN CLASS, Tuesday 26th April.
- Final Examination: Thursday 5th May 2:00 pm to 4:30 pm
- Assignments:
- 1: Due 15th Feb: High-Precision Calculator
Perform addition of integers up to 1000 digits
long, with a nice professional-looking web interface, using CGI.
- 2: Due 24th Feb: Super-Calculator
Add subtraction and multiplication to the functionality of your calculator (and
division for extra credit); take into account any feedback from the first assignment.
- IMPORTANT: Programs are graded for quality and clarity
of design and implementation. Merely "working" is not enough. From now on, significant points
will be deducted for failure to use functions appropriately, lack of consistent indentation,
and general folly. Conversely, having a program work is not make-or-break: you will receive a
good grade for a well-designed clear program even if it doesn't work.
- 3: Due Friday 25th March - Note new due date: Database
(Full Description Here) (not CGI: it needs to be interactive)
Read a database of people into a Flexible 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, or whatever)
and show first few. 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.
- 4: Due 7th April Advanced Sorting for Database
Exactly the same as the previous assignment, BUT you must
you must provide TWO sort commands. They should behave identically, except that one
must use a faster sorting algorithm than the other.
Both should report how long each sorting operation takes (see
here for how), and you must verify that the fast algorithm really is significantly faster.
- 5: Due 26th April Linked-List Database
Exactly the same as the pre-previous assignment, BUT you must
store your database in a linked list, NOT an array or vector. You do not need to keep
the sorting operations in this version, as sorting a linked list gets rather silly
(but see the extra credit assignments).
- 6: Due Wednesday 11th May: Game Program
(Basic Requirements Here)
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.
- Extra Credit Assignments:
- Make your CGI super-calculator complete, including division, to-the-power-of, and a simple
memory function (at least like the MC, MR, and M+ buttons on cheap calculators).
- Make a library version of your super-calculator, so that programmers (e.g. you in the future)
can (after including this file in a program) declare variables of type BigInt, and
use the operators +, -, *, =, <<, and >> on them, just as you would with normal int
variables in a C++ program.
- Using the CGI web programming interface, make a Date Calculator: given year,
month, day, and number N, calculate date and day-of-week N days after the given date. No
limits on year or N.
- Using the CGI web programming interface, make a Calendar Creator: given year and month, display a nicely
formatted calendar, no limits on which year user may select.
- Interesting Game: Add to your basic game other creatures or robots that move around and do
things without the user's intervention, so that it seems as though someone else is playing too.
- CGI game: make your game run as a CGI program, so that you (or anyone else) can play it over the web.
- Multi-User game: make your CGI version of the game maintain a single representation of the "state
of the world", so that if two people happen to be playing it at the same time, they may meet
and interact.
- Complicated Numbers: Create a programmers' library that makes Complex and/or Rational
available to the programer. It should be possible to declare Complex or Rational variables, and
perform the operations =, +, -, *, /, <, >, ==, <<, >> on them. (Complex numbers
involve the square root of minus one, e.g. 2.61+0.05i; Rational numbers are fractions, e.g. 7/3; both
are useful in the real world).
- Logic Programming:
(Description to appear here soon).
- Class History:
- Class 1 (18-1-2004) General introductions; what the class is about.
- Class 2 (20-1-2004) General notions of good programming; accessing the systems; the big number example.
- Class 3 (25-1-2004) The prerequisites test.
- Class 4 (27-1-2004) What we learned from the prerequisites test,
(test solutions).
- Class 5 (1-2-2004) A strange file-processing example
(notes).
- Class 6 (3-2-2004) HTML, HTTP, and CGI introduction
(HTML tutorial),
(HTML reference).
- Class 7 (8-2-2004) Making active web pages
(notes),
and getting CGI input
(notes).
- Class 8 (10-2-2004) Continued from Tuesday: making a connected web site, forms, etc.
- Class 9 (15-2-2004) Proper use of C++ strings
(full string documentation).
- Class 10 (17-2-2004) Usefulness of big numbers (RSA encryption), division, more on implementing strings.
- Class 11 (22-2-2004) Reinventing the String (notes).
- Class 12 (24-2-2004) Introducing Objects with Strings (notes).
- Class 13 (1-3-2004) Using * for a pointer to an array (e.g. char *), memory allocation for variables and arrays. (notes).
- Class 14 (3-3-2004) Defining a dynamic String object; Making resizable safe arrays. (notes).
- Class 15 (8-3-2004) Implementing operators; programmers' libraries; processing a database.
- Class 16 (10-3-2004) An object oriented database design: extensible arrays and modular objects.
- Spring Break.
- Class 17 (22-3-2004) Deriving a sort-verifier and a sorting function without effort; self-documenting program design.
- Class 18 (24-3-2004) Generic compare and sort functions; switch vs if; speed; bubble sort vs selection sort.
- Class 19 (29-3-2004) Mid-term test, Note changed date.
- Class 20 (31-3-2004) Analysing speeds of bubble-sort and selection-sort; introducing merge-sort.
- Class 21 (5-4-2004) Test returned; C programming (as opposed to C++): old strings and stdio.
- Class 22 (7-4-2004) Rational development processes again, deriving Merge-sort.
- Class 23 (12-4-2004) Reference variables and pointer variables and arrays.
- Class 24 (14-4-2004) Layout of code and data in memory; stack frames; details of pointers and addresses.
- Class 25 (19-4-2004) Completing linked lists (pre-notes).
- Class 26 (21-4-2004) More examples with linked lists.
The Test
And The Solutions
- Class 27 (26-4-2004) Careful examination of recursive reasoning. The family tree case-study
(the problems).
- Class 28 (28-4-2004) More on analysing recursive functions.