Homework 3 Information, ECS50 Spring 2007

  • Written homework due by 4:45PM on Wednesday, April 25th
  • Programs due by 11:59PM on Wednesday, April 25th
  • 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.8
    (8) Problem 4.13 (program) with the following modification:  You are *not* 
    				to use the OV flag.  Find another way.
    (9) Problem 5.2
    (10) Problem 5.3
    (11) Problem 5.5
    (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).
    
    ---------------------------------------------------
    
    (14) Problem 5-12. With the following modifications.
        Prompt the user for the size, and elements 
        of the array (just like in the previous problem).
        Then sort the array (you can use any sorting
        algorithm you want). 
    
    For any clarifications post to the newsgroup, or email 
    the TA at cs50t@cs.ucdavis.edu