For example, if the file contained the following:
program: (noun) A magic spell cast over a computer allowing it to turn one's input into error messages.your program should report that there were 2 words of length 1, 2 of length 2, 0 of length 3, 5 of length 4, etc. One way to display this information would be:
Length Frequency ----------------- 1 2 2 2 3 0 4 5 5 5 6 0 7 1 8 3(Note that I have considered "one's" to be a 5-character word rather than a 4-letter word. Do whatever is easiest when handling words containing apostrophes.)
type intarray = array[1..30] of integer; var frequency : intarray;At the start of your program, you should set frequency[1], frequency[2], etc. all equal to 0. Then, read the words one at a time. For each word, add 1 to frequency[?], where ? is the length of the word. By the end of the run of the program, frequency[1] should contain the number of 1-letter words in the input file, frequency[2] the number of 2-letter words, etc. You may use ReadWord again.
You may assume that no word is longer than 30 letters.
You should probably create your own small text file for early testing of your program. Once things are working pretty well, you should try your program on the dictionary file words.txt, or on /LocalLibrary/Intel_LocalLibrary/Literature/ByTitle/CanterburyTales/Group_A/The Milleres Tale, or on any other file you might find in /LocalLibrary/Intel_LocalLibrary/Literature or on the Web. An interesting source of text files is http://www.promo.net/pg/, the home page for Project Gutenberg.
1:2 2:52 3:514 xx 4:2011 xxxxxxxx 5:3275 xxxxxxxxxxxxx etc.
We'll talk more about this program in class.
Start early, keep in touch, and have fun.