Assignment 10, due November 4

Part of the homework for 22C:60, Fall 2005
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated, and unless there is what insurance companies call "an act of God" - something outside your control; the only exceptions to this rule will be by advance arrangement.

  1. Consider a program with two global integer variables, A and B. One way to declare these would be to put each in a separate common block, with the declaration:
            COMMON  A,4
            COMMON  B,4
    

    An alternative would be to put them together in one larger common block, as:

            COMMON  AB,8
    A       =       0
    B       =       4
    

    a) Write code to carry out the assignment A=B in the context of the first declaration above with two common blocks. You will probably need to use some auxiliary declarations as well as the executable code for the assignment. (1/2 point)

    b) As above, write code to carry out the assignment A=B in the context of the second declaration with just one common block. (1/2 point)

  2. In the spirit of exercises j and k in Chapter 10 of the notes, give the normalized floating point representations of: (1/5 point each)

    a) 0.110 (note, the real problem here is normalization)
    b) 1.110 (note, 1.0 is given in the notes)
    c) -2.210
    d) 10.010
    e) 0.0110

  3. From Chapter 10 of the notes, do exercise q). (1/2 point)
  4. Modify the code from the test file distributed for machine problem 5 so that is contains an extra box object that looks like the following when it is rendered. Hint: The box contais two subsidiary boxes (one of height 0, one of width 0) and a text object. (1/2 points)
    +---------+
    | +-----+ |
    | | HAH   |
    | +       |
    +---------+