This website is preserved for historical and scholarly reference and is no longer actively maintained.
                         CpSc 241, Section 1
                             Assignment 1
                           21 January 2000


Due: Wednesday, January 26 at midnight

Late penalties: 20 points per partial day late.  That is, programs
	turned in after midnight Wednesday and before midnight Thursday
	will have 20 points deducted for late, programs turned in after
	midnight Thursday and before midnight Friday will have a total
	of 40 points deducted for late, etc.

Total point value of assignment:  100 points

Late submissions not accepted after: Sunday, January 30 at midnight

This assignment is to be done in groups of two or three.  Since it is
illegal to give your computer password to anyone else (even for the
purpose of doing this assignment) you will need to send copies of
the program to one another using Email.  You may find it convenient
to meet as a group in a lab and all gather around the same computer
and then Email the finished program to the other members of the group.

Please Email the instructor a list of the people working in your group.

Please call your program that meets the requirements of the assignment

				a1.cc or a1.cpp

and submit your program using the handin command.

The objective of this program is to give you some more experience working
with the C++ environment and the concepts of Chapter 1.  You are to
write a C++ program as follows:

You will find a collection of sorting algorithms in C++ in
Chapter 7 (pages 253-295).  You may use any of these sorting
functions, but be sure to cite the text and the page number
in the comments that accompany the function (10 point deduction
for failure to cite copied code).  Insertion Sort (page 2540 is
a particularly nice and simple sort.

Input:

	Using cin, request the user to enter an even positive integer.
	Test the integer for positive and even.  Continue requesting
	an even positive integer until the user complies with this
	request.  In the following discussion we call this integer n.
	The request for input should be done by a function which
	reads and returns n to the calling program by whatever means
	you wish.

	One at a time, request the user to enter n integer numbers
	which may be negative, zero, or positive.  They should not be
	sorted in any way, but it is not necessary to tell the user
	not to sort the numbers.  The program should not assume any
	order for the integers.  This input should be handled by a
	second function which receives the integer n and an array as 
	parameters.  The function stores the n numbers read in the
	array.	





Output:

	Write a function which receives n and the array and prints
	out the array.

	Write a function which finds the kth largest using either 
	algorithm given on page 1 of the text.  k is n/2.


Other requirements:

	Either write all functions in a single file or in such a manner
	that only the main will be executed.

	The names of all group members MUST appear at the top of the
	program.  Other required information which must be typed 
	as a comment at the top of the program:

		the assignment number
		the date completed
		a short statement of what the program does


Grading rubric:

	Required documentation 10 pts.
	In the opinion of the instructor the program is an honest attempt
		to complete the assignment as described  10 pts.

	If the two previous requirements are not met, no further points
		will be awarded.

	The program compiles without error (g++ assumed -- you must
	proclaim on the first line of the program if the program will
	not run with g++, but will run with CC.  20 points

	The program reads the input  10 points

	The program prints the input array correctly 20 points

	The program correctly computes the kth largest for instructor's
		data.  30 points