Counting Words
Write a C++ program that reads in words from a file, discarding any strings
that do not look like words.
The words must be stored in alphabetical order in a linked list, with
each node holding the word and a count of the number of occurences of the word.
The file name is supplied as a command line argument, and when the file
has been read, the words and their occurrence counts are output.
You must use the string
class in
stringclass.h and
stringclass.cpp for storing
individual words.
You must use the linkedlist
class in
linkedlistclass.h and
linkedlistclass.cpp for
the linked list.
The output should look something like this (this is the output from the
answer, but the format is not important):
Cannot(1) Char(1) InputFile(2) MyString(1) ReadWordsFromFile(1) Usage(1)
Word(3) WordCount(1) a(1) arguments(1) at(2) cerr(2) cout(9) else(5) end(1)
error(1) file(1) for(1) if(8) ifstream(1) int(4) is(1) larger(1) linked(1)
list(3) not(1) of(1) open(1) out(1) stopped(2) string(2) struct(1) to(1)
typedef(1) void(2) while(3) word(1) wordcounter(1)
The output from this file of words is something
like this.
Answer