0% found this document useful (0 votes)
5 views2 pages

Lab7-A VL

The document outlines the requirements for Lab 7 of CSE108, focusing on three parts: implementing a function to sort strings alphabetically, generating tags for words based on their length, and writing comments for the code. The lab is graded out of 100 points with specific point allocations for each part and emphasizes no collaboration or partial credits for certain sections. Students have 80 minutes to complete the lab tasks.

Uploaded by

Berkay Çelik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Lab7-A VL

The document outlines the requirements for Lab 7 of CSE108, focusing on three parts: implementing a function to sort strings alphabetically, generating tags for words based on their length, and writing comments for the code. The lab is graded out of 100 points with specific point allocations for each part and emphasizes no collaboration or partial credits for certain sections. Students have 80 minutes to complete the lab tasks.

Uploaded by

Berkay Çelik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSE108 – Computer Programming Laboratory

Spring 2022, Lab 7 - A


This lab will be graded on a scale of 100. No collaboration is permitted.

No partial credits for Part 2 and Part 3.

0, 20, and 50 pts will be given as credits for Part 1.

You have 80 minutes.

Part 1 (50pts)

void alphabeticSort(char arr[][MAX_LEN], int n);

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)

void generateTagParser(char temp [], char arr[]);

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 /+ +/.

Here are some examples

Enter a string: tes


<<tes>>

Enter a string: test12345

*test12345*

Enter a string: test123456789

/+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.

You might also like