CS100, Spring 2000, Project 3: Stars and Loops Forever

Due in lecture, Tuesday, February 22.

===============================================================================
Part 1: More on Processing Input -- The Last, Longest Run
===============================================================================

   Write a program Project3_1 to:
   (1) Read a sequence of non-zero integers; the sequence is terminated by 0.
   (2) Print the lower and upper bounds of the 
       last longest run of consecutive-increasing integers.
   (A "run" is a contiguous subsequence.  A sequence of integers is 
   "consecutive-increasing" if each element is one more than the previous.)

   Example: 9 9 9 8 7 6 5 6 7 7 2 3 4 5 7 8 9 has last longest run 2-to-5
          ( 1 1 1 1 1 1 1-2-3 1 1-2-3-4 1-2-3 <-- lengths of runs )

   Note: in the example above, 2 3 4 5 7 8 9 is NOT a longest run because
   the numbers are not consecutive: 6 is missing.

   HINT: This is like the mode and steepest gradient questions: Keep track of
   + The upper and lower bounds of the longest run so far.
   + The lower bound of the longest run ending on the previous value
     (the previous value is the upper bound of that run).

   Input sequences -- each to be entered ALL ON ONE LINE:
   + 0
   + 5 0
   + 5 6 8 9 10 11 -5 -4 -3 -2 1 2 3 0

===============================================================================
Part 2: Nested Loops -- "It's Full of Stars!"
===============================================================================

   Write a program Project3_2 to:
   (1) Read a pair (x,y) of integer coordinates, x>=0, y>1,
       of the "bottom" vertex of a triangle 
       with "top" vertices (0,0) and (10,0).
   (2) Draw the filled-in triangle using stars ("*").

Examples:  (x,y) = (5,5)     (x,y) = (20,5)           Note:
                                                      
          x           1   x           11111111112     the y-coordinates "left"
      y     01234567890     012345678901234567890     and x-coordinates "above"
      0     ***********     ***********               the triangles are to help
      1      *********          *********             you understand what is 
      2       *******               *******           going on.  Your program
      3        *****                    *****         is NOT required to print
      4         ***                         ***       those coordinates.
      5          *                              *

Note: Your triangles do not have to look exactly like this, 
      but should look close.

    Input pairs -- each to be entered ALL ON THE SAME LINE:
    + (x,y) = (0,4)
    + (x,y) = (5,11)
    + (x,y) = (31,7)

Bonus: print the x and y coordinates to the left and above the triangles.

===============================================================================
What To Submit
===============================================================================

   Follow the submission instructions and other procedures from the Projects
   webpage.  Include all programs and unedited input and output.