Initialize Project 3, Include STUB functions

++ PA03 files
++ Makefile for PA03
This commit is contained in:
Charles Descamps 2023-09-13 10:38:50 -07:00
parent 1169a2607e
commit ff284efcf5
11 changed files with 3506 additions and 0 deletions

79
PA03-0920/PA03_Main.c Normal file
View file

@ -0,0 +1,79 @@
// 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;
}