CIS 181 Intro to Comp Sci
Class 2, February 10, 2005

UNIX TIPs OF THE DAY:

Spend some time NOW getting familiar with the editor of your choice
(e.g., xemacs). Run through the entire xemacs tutorial -- you
will get some instructions for doing this in lab on Monday. Taking
time now will save LOTS of time in the long run.

If you change your shell to tsch, then you can save on typing.
When typing a file-name on the command line, hit the TAB key. If
you have typed enough of the file-name to make it unique, unix will
complete the name for you. If you have not, it will complete as
much as it can be sure of, and beep at you for more input.

-----------------------------
ASSIGNMENT:

Reading: D&D, Chapt. 2 - 2.10: pp. 70-98.

Exercises: pp. 66-67: #1.19, 1.22, 1.26 (on machine)

-----------------------------
TODAY'S TOPICS

  1. Another C++ program -- input two numbers and printer their sum:  fig1.6.cc

  2. Compiling (preprocessing, compiling, linking) and executing the program on our system: Use the two Unix commands
    CC fig1.6.cc
    a.out

  3.  

  4. C++ arithmetic operators +, -, *, /, %
    arithmetic expressions
    assignment statements
    operator precedence
  5. A program to read an integer and determine whether it is even or
    odd. See the file $CLASSHOME/examples/01-even-or-odd.cc
  6. Relational operators

    == equal
    != not equal
    < less than
    <= less than or equal (note that the symbols are written in the same order as they are normally read)
    > greater than
    >= greater than or equal

    The precedence of the relational operators are all less than all
    the arithmetic operators.

    For example,
    x + y + z <= x * y * z is the same as (x + y + z) <= (x * y * z)

  7. The ONLY operator introduced in chap 1 that associates from right to
    left is the assignment operator =. Thus we can do multiple assignments
    by writing statements like

    x = y = 3;

    which means

    x = (y = 3);

    To understand this we need to understand first that the value of the
    expression y = 3 is 3. Thus we first assign the variable y the value
    3 and then assign x the value of the expression (y = 3).

  8. A program that reads two integers from the keyboard and prints
    information about their relationship. See the file
    $CLASSHOME/examples/00-2ints.cc