Lew Baxter's Seneca Webpage

In Fall 2010 I teach IPC144 Sections I and J, and BTP500.



Students are expected to write C programs that are correct, user friendly and programmer friendly. Your assignments will be marked accordingly; typically: 60% for correctness, 10% for user friendliness and 30% for programmer friendliness. Click guidelines for more details, and also, see the following sample C programs. You can copy any of these programs from my public IPC144 directory on matrix to your own directory, eg:

cp ~lew.baxter/ipc144/hello.c .

hello.c prints my name - uses: printf
rectangle.c calculates area and perimeter of a rectangle - uses: comments, variables (int), printf, scanf, math operations
addtimes.c adds two clock times given in hours and minutes - uses: / (integer division), % (integer remainder)
simple.c calculates simple interest from principal, interest rate and number of years - uses: float (double) variables and calculations, %.2lf
compound.c calculates compound interest - uses the math function, pow, #include <math.h>, compiling with 'cc -lm'
toll.c calculates toll charge - uses: if
sin.c determines if a SIN is valid - uses: if-else, / and %
digit.c - prints the English name for a digit (eg: three for 3) - uses: switch (with break)
countdown.c - counts down (eg: three two one) - uses switch (without break)
rich.c - watch your money double - uses while, and ++
average.c and average1.c - calculate average of numbers - uses 'for', and 'do while'


Week 1 :  Lecture 1  Lecture 2
Week 2 :  Lecture 1  Lecture 2
Week 3 :  Lecture 1
Week 4 :  Lecture




Integer Overflow – or why does multiplying large numbers give strange results?