LAB 13: INSERTION SORT WITH VECTORS

Due: 9:30 am, Thursday, 11/21

Do Programming Project 8 on page 696 of the textbook. Basically, you need to implement one of the sort algoritms called "Insertion Sort". (We did not discuss this sorting algorithm; it is explained on pages 634-636 of the textbook).

Make sure that you use vectors and this particular sort algorithm in your program.

* You will lose points if you use a different sorting algorithm.

Your program should ask user to enter positive integers and input should terminate with a 0 or a negative number. Store those integers in a vector (of int), sort the vector using insertion sort (in increasing order).

Finally, print out the numbers in the sorted order.

A sample dialog would be as follows:

Please enter positive integers, terminate with a non-positive one.

7 8 19 5 2 1 1 6 0

The numbers sorted in increasing order are:

1 1 2 5 6 7 8 19