
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Assigned: Friday September 29, 2006 Due: Wed, October 4, 11:59pm.
For this assignment, we will perform various operations on arrays of characters (“strings”) and arrays of character pointers. A skeleton hw5.cpp program is provided, along with the associated MSVC project files. The assignment has three parts.
Token 0 is This Token 1 is is Token 2 is a Token 3 is test
Implement subroutine StringCat, which takes a pointer to an array of strings as an argument, and produces a single string that is the concatenation of all of the input string. The input array of strings has the null pointer “NULL” as the last value. You should limit the resulting concatenated string to no more than MAX_CONCAT characters, which is defined to be 70 characters in the provided skeleton. The StringCat function prints the resulting concatenated string using printf. You might implement this using strcat, but you would have to be careful to not overflow the concatenated buffer. A better choice might be to copy the characters with a loop instead.
Implement subroutine StringInsertionSort, that creates a sorted array of strings in lexical (dictionary) order. This subroutine will be called repeatedly, requesting a single string be added to the sorted array. This subroutine has three parameters as follows:
a. char** pSt = pointer to an array of string pointers already in sorted order. b. int n – length of the string pointed to by pSt (which might be zero indicating there are currently no elements in the array). You can assume the pSt array always has room for one more element (ie. the length is always at least n+1. c. char* newSt = pointer to new string to be added to the sorted array.
The provided main function has the test cases you are to use, so you should only work on the three subroutines listed above.