CIS 181 Intro to Comp Sci
Class 5, February 22, 2005

UNIX TIP OF THE DAY:

Unix contains an alias command that allows you to (re)name unix commands to better suit your needs. It is common to put alias commands in your .cshrc file since this file is run automatically each time you enter a new unix shell. For example, since I use the more command very often, I have renamed it to m by putting the following line in my .cshrc file:
alias m more
 


ASSIGNMENT Due Thursday 2/24:

Reading: D&D, pp. 182-217 (most assigned before)

Exercises: pp. 241-243, #3.11, #3.19 (Reminder: the length of the hypotenuse of a right triangle is the square root of the sum of the squares of the other two sides. Make sure you write the function, and a main program which calls the function so that you can show the function works.)


TODAY'S TOPICS
  1. Using the switch statement -- flow control example -- the 12 days of Christmas. See file $CLASSHOME/examples/07-12-days.cc
  2. Going over the homework - Exercise 2.47 and 2.47 Extra Credit Part
  3. Logical Operators: and (&&), or (||), and not (!)
  4. C++ functions
  5. 5.1 Math Library Functions -- function calls, header files, and linking in standard libraries.

    5.2 User Defined functions -- function prototypes, function definitions, calling user defined functions. A first example: computing the maximum of two ints and using the function in a program to read three numbers and to print the largest. See the file: $CLASSHOME/examples/3max.cc

  6. A closer look at function definitions and function prototypes.
  7. A second simple example: A program to calculate whether a number is even or odd. See the file: $CLASSHOME/examples/fun-even.cc