

The program starts by defining the basic libraries we were using. For this lab we needed <iostream>, <fstream>, and <string> to use input/output variables and expressions, instream/outsream files, and the string variable type, respectively. I used using namespace std; in order to use the commands in the standard library and save time. The program begins by declaring some variables and declaring a few void functions. All of these would be used well when the time came for it. I defined our array for having 80 more spots than needed just to guarantee no chaos ensued. I created the functions for all the sorting again to be defined later. The program began with the main function, where the program asked which type of sorting was requested using cout. The program continues by declaring more variables to be used for the method of displaying the array. After selection, the program imports the files using ifstream and then has a clause to break in case the data file instreamed was too large. Starting with selection sort, the program was designed to then display the initial unsorted data should that had been chosen, and proceed to sort it and post it in the manner requested. The same was done with the bubble sort and the insertion sort. Selection sort, given a list, takes the current element and exchanges it with the smallest element on the right hand side of the current element. The bubble sort, after i iterations, the last i elements are the biggest, and ordered. In each iteration, it sifts through the unsorted section to find the maximum. The insertion sort, after i iterations, the last i elements are the biggest, and ordered. In each iteration, sift through the unsorted section to find the maximum. The program outputs whatever was request using couts and cins.
This program did not come easily at all. It took a while to understand the references concept. Not only that, but we had to be shown how to begin because the entire class was incapable of finding how to begin. Once the initial ropes were laid out, it became easier to do the other sorts on our own. There were like always some semi-colon forgetting and some mistyping variables, but that was expected and quickly fixed. The challenging thing personally was that I did not expect the program to be so long and to have so many brackets. The main errors was trying to match the brackets correctly and put them in the right place. This used about an hour and a half to realize that all the errors that were being reported were from one bracket. Lesson learned. Bracket beforehand kids. Also, figuring out how many loops and where to place them was equally challenging. All in all, this lab was a great way to further showcase my acquired programming ability despite a few bumps along the way.
Computer mastery I welcome your challenges with an open mind and an open keyboard!!!
Computer mastery I welcome your challenges with an open mind and an open keyboard!!!





