CIS 71 (section 1): Homework 9

Handed out: 4/01/97
Due: by 2:30pm on 4/08/97
Email program to btrianta@thunder.temple.edu

The program will read a sequence of positive integers terminated by a non-positive sentinel value and store them in an array. You can assume that there will be at most 20 positive integers in the sequence. Print out the positive values you have read.

Sort the sequence in non-decreasing order using the bubble sort method. Print the resulting sequence.

Now prompt the user to enter a positive integer and return the position where that integer is in the sorted sequence (return -1 if it is not in the sequence). Repeat this until the user enters a non-positive integer.

As a comment at the beginning of your program you should do a case analysis for this problem: problem statement, analysis, design, implementation, and testing.