Due: May 25, 2023
Points: 100
Hello, there! How are you? I am fine; how are you? My number is DE4-3656.the words are “hello”, “there”, “How”, “are”, “you”, “I” “am”, “fine”, “how”, “are”, “you”, “My”, “number”, “is”, “DE4”, and “3646”.
Write a program that reads lines from a file (you may assume it’s a text file) or files named on the command line, breaks them into words, stores the words in order (that is, ASCII order), and counts the number of times each word appears. Do not make any assumptions about the number of lines or words; but you may assume no word is over 256 characters long. When this is done, print the words and counts, as follows. This example is from the line above:
3646 (1) DE4 (1) Hello (1) How (1) I (1) My (1) am (1) are (2) fine (1) how (1) is (1) number (1) there (1) you (2)Call your file wordsort1.c.
Here is the same list as in the example in problem 1, but in lexicographic order:
3646 (1) am (1) are (2) DE4 (1) fine (1) Hello (1) How (1) how (1) I (1) is (1) My (1) number (1) there (1) you (2)Call your file wordsort2.c.
Call your corrected file “calcans.c”.
|
ECS 36A, Programming & Problem Solving Version of May 15, 2023 at 3:32PM
|
You can also obtain a PDF version of this. |