CIS 181 Intro to Comp Sci
Class 7, March 1, 2005

Reminders:

First exam: Scheduled for Thursday, March 10 -- covers chapters 1-4.?. 

First project due: Tuesday, March 8


UNIX TIP OF THE DAY:

ls
will list the files in a directory.
ls -a
will show the "dot files" in the directory
ls -l
will give a "long listing" in alphabetical order which will give you lots of information about the files. This information includes information about who hasread/write/execute privileges on the files (this is in three groups -- rwe for owner, group, and world), who owns the files, how big they are, when they were created, and their name!
ls -tl
will give the "long listing" ordered with files most recently written appearing first.


ANOTHER UNIX TIP OF THE DAY:

More in tshell -- earlier you learned to use <ctrl>-p to get the previous unix command on the command line (and to cycle through that list). You can also edit the command line using regular emacs commands. This is useful if you have just typed a long command that is ALMOST what you want. Commands I use a lot: <ctrl>-a -- move to beginning of line, <ctrl>-f -- move forward 1 character, <ctrl>-d -- delete a character. Remember, you can always add characters to the middle of the line by simply moving your cursor to the right place and typing!

Just hit return when your changes are done and the new command will be executed.


ASSIGNMENT:

Reading: D&D, through pp. 278

Exercises: pp. 246-248, # 3.40, 3.44


TODAY'S TOPICS
  1. Recursive functions
  2. Simple recursion -- computing factorial of a number. See the file $CLASSHOME/deitel-files/examples/ch03/fig3_14.cpp (see $CLASSHOME/deitel-files/examples/ch03/fig3_14.exe for executable).
  3. Another example of recursion -- fibonacci series
  4. inline functions -- defined as a function, but contains a request for the compiler to simply insert the code "inline" thus saving the overhead of a function call at execution time. Only reasonable for very small "one line" functions.
  5. A case study: calculating parking charges -- Exercise 3.12, see $CLASSHOME/examples/10-parking-charges.cc
  6. Reference and Reference Parameters -- See the file $CLASSHOME/deitel-files/examples/ch03/fig3_20.cpp (see $CLASSHOME/deitel-files/examples/ch03/fig3_20.exe for executable).
  7. Default arguments -- note defaults are specified in the function prototype.
  8. Unitary Scope Resolution Operator -- allows access to a global variable even when there is a local variable by same name in the block.
  9. Function Overloading.