CIS 15BG Assignment 1
Insert sort and bubble sort, 1 dimensional array of characters.
This program is about 200 lines of space, comments, and code.
If you wish, you may do this problem in a team of two. Clearly identify which student codes which of the following parts. Programmer 1 should code only the insert function. Programmer 2 should code everything else. Both will receive the same grade, so each student should carefully check the entire program.
Write a program which will do the following:
- Declare an array in main, to contain 8 characters.
- From main, call a function named insert. The insert function will use getc to read the characters one at a time from a file. Each character will be inserted into the array in ascending ASCII order. Thus, the array will be sorted, without needing to sort the array later after the characters are inserted.
- From main, call a function named print. The print function will print the contents of the array in order.
- From main, call a function named lower. The lower function will convert all the characters in the array to lower case.
- From main, call the function named print. The print function will print the contents of the array in order.
- From main, call a function named bubbleSort. You can copy this program from Program 8-10 on page 495 in the text book. Change it to work with char type data. Be sure you understand how it works.
- From main, call the function named print. The print function will print the contents of the array in order.
In each function you write, except main, the array will be processed using a loop.
Test the program with the following data: aBcDeFgH