CS322: Sample C/C++ Programs

wordcount.c

This program copies a file from standard input to standard output. Each word from the original file appears on a separate line in the output file. A count of the number of words processed is printed at the end.

wordtable

This program reads a text file and lists the words occurring in it, together with their frequency of use. It illustrates breaking a program up over multiple files - in this case two .c files and a .h file.