The purpose of this part is to let you have some experience on File I/O
in the C language. You are expected to implement a word counter that is
able to count the number of occurrences of every word in a text file. The
basic requirements are as follows.
The word counter should be case-insensitive. For example, there are
two occurrences of the word,"the", in the sentence, "The events in
question occurred in the early days of my association with
The word counter should be able to ignore the punctuation. For
instance, "Holmes." and "Holmes," should be counted as "Holmes".
The word counter should read the filename via command line.
The word counter should print out the top 20 words in terms of the
word frequency in descending order.
You can use your linked list of Project 5 if necessary.
Use this file to test your word counter.
Your output should look like
Part II: Functions and File I/O in Selected Languages
For the first two tasks of this part, develop a wiki page for each of
your languages that shows examples of file I/O and function definitions.
Focus on the semantics of function declarations, how function arguments
are defined and used, and how functions are treated as a data type.
For each of your languages, create some example programs that
demonstrate reading and writing to both the terminal and to a file.
Some things to consider in your examples and write-up include the
Does your language have built-in support for I/O, or is it part
of a set of standard libraries?
Does your language support different types of files, such as
binary v. text files?
Can the user input information into the program
What is the relationship between files and strings? Demonstrate
similarities and differences in the way the programming language
For each of your languages, create some examples of functions.
Explore the variations in the way functions and their parameters are
Issues to consider include the following.
How do you define the return type of a function? Must all
functions have a return value or type?
Can you overload functions in your language? If so, what are the
rules for differentiating overloaded functions?
Can you create functions with an unknown number of arguments? How
do you access those arguments?
Can you dynamically create functions? If so, how?
Can you override functions with a new definition?
What mechanism exists for publishing the existence of a function
to other functions or compilable units (e.g. files)?
For each of your languages, implement a word counter. The basic
requirements are the same as those for the word conter in C. Use the
same file to test your program.
Undertake one or more of the tasks for a third language.
Write a compilable haiku on functions or file I/O in the selected
How does your language treat files accessed over the internet?
Make your word conter more robust so that it is able to handle
invalid command-line inputs and invalid files.
The submission of this project has three components:
Codes: The source codes of word counter in C and the selected
languages should be submitted to the fileserver, so as for the code
examples for task 1 and 2 of part II. Please make the filename of your
source codes meaningful.Note that the quality of
your comments counts toward your grade.
README: In this project, you need to submit a README file for your
word counter in C and the selected languages. The README file can be a
.txt file. It should be well-organized in a way that readers can easily
know the usage and the outputs of your word conter in every language.
In addition, the known bugs of your codes should also be indicated in
the README file. Please also indicate the version of your C complier,
your operationg system, and its version in the README file.
Wiki write-up: The write-up of this project should have the following
Title of the project and your name
The tutorials on function and file I/O in the selected
languages (task 1 and 2 of part II)
Please include necessary code snapshots in your tutorials.
Please note that it is your responsibility to explicitly indicate the
extensions you have taken. If you take the extension regarding the
word counter, please indicate explicitly in the codes and README file. If
you take the extensions in function anf file I/O in selected languages,
please indicate explicitly in your wiki write-up or source codes and