Computer Science 1320
Homework 9
Fall Semester 2009
For this homework laboratory exercise we shall study text and text processing. We shall write several functions which will provide us with characteristics of English usage.
The goals of this exercise are text and string processing, files, arrays of characters, arrays of strings, sorting strings.
A body of text must be prepared as input for this exercise. You may use virtually any large body of text. We shall do the following:
0. Command line arguments are required
1. Read the text letter by letter into a big array of characters
2. Re-read the text word by word into an array of strings
In order to make sure we have only words, we shall eliminate all punctuation from the text, keeping only alphabetic characters, spaces and newlines.
3. Count the occurrences of each of the alphabetic characters in the text. How many a’s, b’s, c’s etc.
4. Tell which character occurs most frequently.
5. Tell the percentage of each character of the total. (There may be 11.2% of the characters that are the letter ‘e’ for example)
6. Tell how many one letter words, two letter words, three letter words, etc.
7. Sort the words in the text into alphabetical order. Use the functionality in <string.h>
See class notes for details. This is all to be written in a single program. You must use appropriate functional decomposition.
Homework due date: To be announced in class.
The usual rules apply. Source code, documentation, sample execution, story, etc. all in a tar archive file and mailed to me on the due date.