CSE 111, Fall 2000

HW #5: PASCAL & DECISION TREES

For this HW, you will need:

There are 2 parts to this HW:

You must do both parts.

I. PASCAL

  1. Log onto Unix

  2. Prepare yourself for compiling and running Pascal programs:

    • Do the following at the Unix prompt (>):

        >pico .cshrc <return>

      This should bring up an already-existing file for you to edit.

    • Print it out.

      NOTE: Depending on how you choose to print this file, you may need to quit pico, print the file, and then do "pico .cshrc" again.

    • (If necessary, do "pico .cshrc" again. Then:)
      Go to the line below the last line of the .cshrc file, and type in:

        set path=($path /util/lang4.2/bin)

      YOU MUST TYPE THIS IN EXACTLY AS SHOWN! BE SURE ALL SPACES ARE IN THE CORRECT PLACES!

      (This will make the Pascal compiler available to you.)

    • Exit the file, saving your changes.

    • Print out the modified file.

    • Log out of Unix; then log back into Unix.
      (This will activate the change in your .cshrc file that you just made.)

  3. Create another Pico file, named firstcode.p, containing the Pascal program on p. 10 of the Great Ideas in Computer Science text.

  4. Compile and run a Pascal program at the computer:

    • At the Unix prompt, do:

      >pc firstcode.p <return>

      (What this does is "compile" the Pascal program from p. 10 that you created above. If you made a serious typing mistake, you will get an error message. If so, try to find and fix the error yourself, but DO ask us for help if you need it!)

    • At the next Unix prompt, do:

        >a.out <return>

      This should print the title of the course. (Actually, it "executes" your compiled program, which the Pascal compiler decided to call a.out.)

      (Note: Do not try to print a.out!! IF you really want to see what it looks like, do

        >more a.out
      You may be asked:
        "a.out" may be a binary file. See it anyway?
      If so, type y.
      Then keep hitting the space bar to see the entire file, until you see (END). Then type q to quit and get back to the Unix prompt.)

  5. Compile, run, and save the output of a program:


II. DECISION TREES

  1. Do Biermann, p. 10, #2.

    Note: It is probably easiest to do this by hand, using pencil and paper; it is NOT a programming exercise (yet ;-)


Turn in the following items, stapled together in the top left-hand corner::

DUE: AT THE START OF LECTURE: WED., OCT. 11



Copyright © 2000 by William J. Rapaport (rapaport@cse.buffalo.edu)
file: 111F00/hw5.02oc00.html