CS 112b
Spring 2004
Ileana Streinu

Lecture 2

From C to C++: arrays and functions

  1. Start by doing the whole lab 1. Discussion.
  2. About lab and homework submissions: You are responsible for making sure you submit all the files that were requested. You must name them exactly as specified in the handout. Later in the semester I will no longer specify routine details. The typescript has to be clean and readable.
  3. More Unix tricks:
  4. C++ comes with an enhanced discipline of programming, which is vital for large programming projects. This is captured in the object-oriented model.
  5. Software Engineering principles help you design rapidly good, readable and reliable code, as well as debug and maintain it easily. We start today with some basic principles for good software design.
  6. Criteria for readability. Header: name, class account, hwk number, what the program does. Comments. Discussion of an example: what is good and what is not with this homework solution (it doesn't work, so do not use it as a model for later homeworks!!). The same program (still not working) but with improved readability.
  7. Organization of the program: functions before main; function prototypes before main, then main, then function code.
  8. Programming discipline:
  9. A (brief) review of arrays in C and C++.
  10. A (brief) review of functions in C and C++.

  11. In-class lab: start working on Hwk 1, which is reviewing arrays and functions in C in the context of the transition to C++.
  12. Handout: The Game of Life. Go over the handout by Tuesday to understand the game. You can also "play" it on-line, e.g. here. You will work on it in class on Tu and Th, and your next homework assignment will be based on it.