#include #include #include #include #define MAX_WORD_LENGTH 31 #define MAX_WORDS 40000 /* Function prototypes */ void readFile(char* inputFileName, int* wordCount, char array[][MAX_WORD_LENGTH]); int qsort(char array[][MAX_WORD_LENGTH], int* wordCount); void writeToFile(char* outFileName, int wordCount, char array[][MAX_WORD_LENGTH]); void printTime(time_t begin); void usage(char* processName); // enter any other function prototypes you may wish int main(int argc, char* argv[]) { time_t begin; char array[MAX_WORDS][MAX_WORD_LENGTH]; int wordCount = 0; time(&begin); switch (argc) { case 3: readFile(argv[1], &wordCount, array); writeToFile(argv[2], wordCount, array); break; case 4: { if (strcmp(argv[1], "-s") == 0) { readFile(argv[2], &wordCount, array); qsort(array, &wordcount); writeToFile(argv[3], wordCount, array); } else if (strcmp(argv[1], "-t") == 0) { readFile(argv[2], &wordCount, array); writeToFile(argv[3], wordCount, array); printTime(begin); } else { usage(argv[0]); } break; } case 5: default: usage(argv[0]); break; } return 0; } // Define all your functions here void usage(char* processName) { printf("Usage %s [-s] [-t] inputFileName outputFileName\n", processName); }