Lab7-A VL
Lab7-A VL
Part 1 (50pts)
Implement the function given above which takes an array of strings and the number of strings as
parameters and displays the strings as they are sorted alphabetically (Example output is Figure 1).
You can use string library functions such as strcmp, strcpy, etc. Here are some examples of strcmp
return values. You should either be careful about the given cases below or just try to find out the strcmp
function by experiencing it yourself.
strcmp("a", "a"); // returns 0 as ASCII value of "a" and "a" are same i.e 97
strcmp("a", "b"); // returns -1 as ASCII value of "a" (97) is less than "b" (98)
strcmp("a", "c"); // returns -1 as ASCII value of "a" (97) is less than "c" (99)
strcmp("z", "d"); // returns 1 as ASCII value of "z" (122) is greater than "d" (100)
strcmp("abc", "abe"); // returns -1 as ASCII value of "c" (99) is less than "e" (101)
strcmp("apples", "apple"); // returns 1 as ASCII value of "s" (115) is greater than "\0"
strcmp("Apple", "apple"); // returns -1 as ASCII value of "s" (65) is greater than "a" (97)
Part 2 (40pts)
Implement the function given above which takes two arrays as parameters and generates the tags on the
words. You should use the temporary array to do copying operations. The second parameter is the original
string taken from the user.
Words less than five characters long are bracketed with << >> , words five to ten letters long are bracketed
with (* *) , and words over ten characters long are bracketed with /+ +/.
*test12345*
/+test123456789+/
Part 3 (10pts)
You should write function comments (Figure 2) and in-line for all reasonable lines of code. An example
proper comment style is given below for function comment. You must fill in the blanks for your
functions. Be careful about the arrays, they would be manipulated by the function even if the function
return type is void! Also, you develop a menu for calling these functions properly.
Figure 1. Figure 2.