Homework 2 Information, ECS50 Summer 2007

  • Written homework due in class on Tuesday, August 21st
  • Programs due by 11:59PM on Tuesday, August 21st
  • Do all problems.

    Assignment:

    (1) Problem 4.1 (a,c,d,f)
    (2) Problem 4.2
    (4) Problem 4.5
    (5) Problem 4.6 (c)
    (6) Problem 4.7 (c)
    (7) Problem 4.13 (program) with the following modification:  You are *not* 
    				to use the OV flag.  Find another way.
    (8) Problem 3.8 (program) with the following modification:  use odd parity
    (9) Problem 5.2
    (10) Problem 5.3
    (11) Problem 5.5 (program)
    (12) Problem 5.6
    
    (13) Create a program that reverses the elements of an array. 
    Initially, define the array as follows:
    
    ARRAY:	.BLKW	20
    
    First you will ask the user how many 
    elements are in the array (could be <= 20), then 
    you will input each of those numbers and store them 
    into the array. If the user enters a size bigger 
    than 20, output an error message and prompt for 
    the size again.  Once all the numbers have been 
    read in, you will reverse the elements and print 
    out the array. Your program terminates when the 
    user enters 0 for the array size, otherwise it 
    keeps on going.
    
    Here's a sample run:
    
    :Enter size of array (max 20) >> 30
    :invalid size!
    :Enter size of array (max 20) >> 3
    :10
    :8
    :15
    :The array in reverse order is >>
    :15
    :8
    :10
    :Enter size of array (max 20) >> 2
    :40
    :20
    :The array in reverse order is >>
    :20
    :40
    :Enter size of array (max 20) >> 0
    :bye!
    
    Your program has to modify the array by
    actually swapping elements (i.e. don't just
    print out the array from the end to the front).