// header file #include "Console_IO_Utility.h" #include "StateUtilities_LogN.h" // local constants for program const int INITIAL_NUM_STATES = 10; int main() { // initialize function/program // initialize variables char fileName[ MIN_STR_LEN ]; StateArrayType *sortingArray; // show title // function: showTitle showTitle(); // create input/working and sorting arrays sortingArray = createStateArrayType( INITIAL_NUM_STATES ); // get input // get file name // function: getFileName promptForString( "Enter file name: ", fileName ); // upload state data, check for success // function: uploadstateData if( uploadStateData( sortingArray, fileName ) ) { // process and display data // display original list displayData( *sortingArray, "Original data after upload" ); // merge sort // function: runBubbleSort runMergeSortByName( sortingArray ); // display bubble-sorted list displayData( *sortingArray, "Full list sorted by name using merge sort" ); // insertion sort // function: runInsertionSort runQuickSortByPopulation( sortingArray ); // display insertion-sorted list - array will start at low value displayData( *sortingArray, "Full list sorted by population using quick sort - lowest to highest" ); // reverse array to start at high value reverseArray( sortingArray ); // display insertion-sorted list - array will start at high value displayData( *sortingArray, "Full list reversed to show population sorted highest to lowest" ); } else { printf( "\nData upload failed - program aborted\n" ); } // end program // report end program // function: printf printf( "\nProgram End\n" ); // clear dynamic array sortingArray = clearStateArrayType( sortingArray ); // return program success return 0; }