EEN118 R (Programming 1) Spring 2015
Tues, Thurs 12:30-1:45 in MM202

Class History

Class 1  Tue 13‑1‑2015   Quick introductions, etc.
What a programming language is about, (ancient programming examples just to show how far we have come: one, two, three, four). The compiler (part of visual studio) now converts automatically from a language people can understand (C++) to the millions of ones and zeros that the computer understands, relieving programmers of the impossible task.
First tiny examples of C++ programs.
Class 2  Thur 15‑1‑2015   The details of what a VS project is, what the different files are, and why so much has to be done for set-up. Control panel - folder options - view: do NOT hide extensions for known file types. VS' options - text editor - all languages - set indent and tab to a reasonable number (3 to 5 is usually OK) and make it convert tabs to spaces.
Making functions: A large but unimpressive program, and an much improved, even quite clever version, but we'll soon do even better.
Class 3  Tue 20‑1‑2015   More adventures in programming, tabulating a formula, and almost getting control of repetition.
sample 1, sample 2, sample 3.
Class 4  Thur 22‑1‑2015   Introduce the "if" statement, and gain complete mastery of controlled repetition.
Yesterday's problem, make the computer tell us what it's doing ...
... and the solution becomes obvious.
Change the order a bit, make sure you understand the result.
We even get a perfectly clear way to tabulate a function nicely.
The mystery function. Make sure you understand it, and how to analyse it.
Class 5  Tue 27‑1‑2015   Deeper thoughts on the analysis of recursive functions. Important concept: the very small and simple function that will print a number in any base.
Plotting a function, the very important const declaration, helper functions (like my_move_to) remove confusion from programs.
Class 6  Thur 29‑1‑2015   What about base 16?: useful tricks with strings, and interactive input.
Making the graph plotter scale properly.
Class 7  Tue 3‑2‑2015   More practice with unix.
Recursive functions that return results, calulating the sum of the squares from 1 to N:
First get the pattern right, just print those squares.
Then slightly modify, return what you would have printed plus the other values.
Now for variety, we introduce the Accumulating Parameter.
And finally we'll take the sum over any range.
Class 8  Thur 5‑2‑2015   Today's starting point went wrong (square root of negative somewhere in the recursion so we caught the error and saw whay accumulating parameters are really useful.
Next thing: Finding the length of the Collatz sequence. Suggested exercise: make the program plot a graph, the X axis is N, the Y axis is the length of the collatz sequence starting from N.
And the fancy triangle: can we automate the increasing fanciness?
Class 9  Tue 10‑2‑2015   Yes, we automated the increasing fanciness in two ways, and also measured the entire length of the snowflake's perimeter.
A useful const array, and a simple way to say numbers.
A giant program that at least gives nicer output, and introduces prototypes.
Finally, a first attempt to make order out of the chaos.
Class 10  Thur 12‑2‑2015   Today's starting point. Being able to speak any number in proper English with a small and quite simple program. Developed step by step: one, two, three, four, five. The final steps to cover millions and billions and negative numbers are left up to you.
Very quickly finding an octopus in this big dictionary of 16384 words.
Class 11  Tue 17‑2‑2015   The search converted to a program on a smaller word list too. Introducing "cout <<" for a happier printing experience.
The "bit-wise" operators, and a function that prints in binary.
Putting them both together, but why?
Class 12  Thur 19‑2‑2015   A sample test.
Now we see why the search and binary-printer were put together. Binary chop search gets one extra digit of the target's position correct for each step. It is logarithmic in time - very fast - because it never has to do more work than the number of digits in the data set's size.
Review 1  Sat & Sun   Voluntary pre-test review sessions, at 3 pm in the lab room, on both days.
Class 13  Tue 24‑2‑2015   How to make bees, and what a caprimulgus does at night, and more biology:
Simulating Brownian Motion, too deep recursion had to be replaced with a while loop.
Some practice with arrays, and the sine calculator.
Class 14  Thur 26‑2‑2015   Test Day.
Class 15  Tue 3‑3‑2015   The Sines, and
Letting you loose on variables.
Class 16  Thur 5‑3‑2015  
8th to 14th Break
Class 17  Tue 17‑3‑2015   The dangers of complacency.
Reference parameters, and the odd-looking sorting program, whose triangular shape indicates that the time to sort N items is proportional to the square of N: it is a quadratic algorithm.
Class 18  Thur 19‑3‑2015   Metaprogramming: The triangular sorting method converted into a program that writes a sorting program for us.
And at last, using loops for a nice compact flexible sorting program.
Class 19  Tue 24‑3‑2015   Files: ifstream, ofstream, open, close, error, tellg, seekg. Strings too: length, [], substr.
A file with an unfortunate format, and our program to process it.
Class 20  Thur 26‑3‑2015   Introducing structs. In arrays, from files, and everything.
Class 21  Tue 31‑3‑2015   Structs aren't only useful for data storage. In the updated periodic table application the input_object struct makes input processing simple. "This is not a string". reading from an ifstream modifies it, even though it doesn't modify the file itself, so make them reference parameters.
Class 22  Thur 2‑4‑2015   The official #includes and using namespace std. Update operators +=, -=, *=, etc. The "for" loop. Methods, the basis of object oriented programming.
all built into our running example.
Class 23  Tue 7‑4‑2015   Some complicated loop and expression examples. Introducing constructors, preparing the calculator to handle whole formulas.
Class 24  Thur 9‑4‑2015   Finally, recursion saves the day, and we can even process parenthesised formulas like Ca(NO3)2.
Final version, getting the output format to look nice was a bit complicated.
Review 2  Sat & Sun   Voluntary pre-test review sessions, in the lab room.
Saturday at 4pm, Sunday at 12 noon.
Deadline 1‑9  Mon 13‑4‑2015   Absolute deadline for any material from labs one to nine.
Class 25  Tue 14‑4‑2015   Practice with structs and arrays: implementing the "fraction" type as a struct, so our programs can do perfectly accurate calculations on fractions; Euclid's gcd algorithm. Implementing a reverse polish calculator using a stack object, you can build in whatever operations you want in a matter of seconds.
Class 26  Thur 16‑4‑2015   Test Day. A recent sample second test.
Class 27  Tue 21‑4‑2015   Special extra lab sessions, Wednesday and Thursday this week.
Bad bunnies: computer simulation.
The boy and the bull.
Class 28  Thur 23‑4‑2015   Don't forget to make use of the visual studio debugger: deb1, deb2.
The final version of the simulation (the mistake was a misplaced curly bracket), and we really get to see pointers in action.
Review Sat 25 Apr   Voluntary pre-final review session at 11 a.m.
Primarily for the Kubat section.
Deadline 10‑12  Fri 1‑5‑2015   Absolute deadline, nothing received after today will be graded.
Review Sat 2 May   Voluntary pre-final review session at 1 p.m.
Primarily for the Murrell section


Lab Assignments

Lab 1, Tues 20 Jan - Mon 26 Jan
(pdf) Using visual C++ to run programs; drawing stars and stick figures.
Lab 2, Tues 27 Jan - Mon 2 Feb
(pdf) Divide and conquer: building big programs from little functions.
Lab 3, Tues 3 Feb - Mon 9 Feb
(pdf) Controlling repetition in programs.
Lab 4, Tues 10 Feb - Mon 16 Feb
(pdf) Generating calendars and using Unix.
Lab 5, Tues 17 Feb - Mon 23 Feb
(pdf) A video game: exploding the enemy with a cannon.
Lab 6, Tues 24 Feb - Mon 2 Mar
(pdf) A real-time animated clock application.
Lab 7, Tues 3 Mar - Mon 15 Mar
(pdf) A randomly generated Happy Street Scene.
Lab 8, Tues 16 Mar - Mon 23 Mar
(pdf) An interactive desk calculator.
Lab 9, Tues 24 Mar - Mon 30 Mar
(pdf) Interactive map of the United States. Data files: state outlines, capitals.
Lab 10, Tue 31 Mar - Mon 6 Apr
(pdf) Database programming under Unix.
Data files: dbfile1.txt, 2, 3, 5, 10, 20, 30, 50, 100.
The special timing function.
Mon 13 Apr
Absolute deadline for all labs 1 to 9.
Lab 11, Tue 7 Apr - Mon 13 Apr
(pdf) A robot seaching for treasure in a maze. sample maze.
Lab 12, Tue 14 Apr - Mon 20 Apr
(pdf) An automatic robot: he turned into a video game.
Extra, Wed 22 Apr - Thur 23 Apr
Special voluntary extra credit lab activities
Active participation and full-time attendance required for credit.
Fri 1 May
Last day anything will be accepted for grading.