CIS 181 Intro. to Comp Sci
Class 6, February 24, 2005

UNIX TIP  OF THE DAY:

The unix man command can be used to find the documentation for any unix command.  For example, if you can't remember exactly how to copy a file/directory (but  ember the name cp) you can type:

man cp
and a page of documentation will be displayed about the various ways the command can be used.  A useful flag on the man command is the -k flag.  This can be used to find out what commands might be relevant to a particular keyword.  So, for example, if you want to copy a directory but can't remember the name cp, type:
man -k copy
This will display a list of commands that might be related to copying.

Don't forget, you can always type

man man
to get information about the man command!


IMPORTANT DATE REMINDER: FIRST EXAM, Thursday, March 10th!!!!

This exam will be an in class exam that will cover chapters 1-3 and part of chapter 4 in the text.


ASSIGNMENT due Tuesday,  March 1st:

Reading: D&D, pp. 211-234 (finish Chapter 3); pp. 252-272 (begin Chapter 4).

Exercises: p. 242 #3.13, p. 249 #3.50 and #3.51


TODAY'S TOPICS
  1. Hand out and discuss the first programming project. This project is due Tuesday, March 8th.
  2. Introduction to random number generation. See the file: $CLASSHOME/examples/rand-num-7-10.cc
  3. Seeding the random number generator. See $CLASSHOME/examples/rand-num-seed-7-10.cc for seeding the random number generator.
  4. Defining an enumeration type using enum. This defines a set of integer constants and gives each a unique name. This allows you to define a variable of the new type, and then the values assigned to that variable will be the constant names. Often very helpful for program readability.
  5. Scopes of variables
    1. The two important scopes are "file scope" and "block scope"
    2. An identifier declared outside any function (including main) has file scope
    3. An identifier declared inside a block (i.e., a compound statement containing declarations) has scope that begins at the declaration and continues to the closing right brace } for the block.
    4. The concept of one identifier "hiding" another because of scope.
  6. Storage classes -- determines the period during which the identifier exists in memory.
    1. Two classes of specifiers for storage classes: automatic storage classes and static storage classes.
    2. Example in figure 3.12 in book shows the interaction between storage classes and scoping rules.
  7. Recursive functions -- and the environment when a function is called (e.g., stacking etc...)