CIS 1057: Homework 8

Handed out: 10/19/2010
Due: by 10:00am on 10/25/2010
Email program to TA

We assume a 'table' where we can store up to MAXSIZE (a defined constant) strings. We assume that each string in the table will have length less than MAXLENGTH (a defined constant). Thus table can be declared as:

	char table[MAXSIZE][MAXLENGTH];

Write a program that in a loop prompts the user to enter a text line. It then modifies the line by replacing capital letters by lowercase letters. Then it takes the tokens occurring in the line [a token is a maximal sequence of non-space characters] and it inserts them without duplication into table.
The loop is terminated when the user enters a line without tokens. Then the program prints out, one per line, after a tab, each token stored in table.

Here is an example of the interactions in a possible run:

Enter line [CR to exit] : Roses   are   VERY red
Enter line [CR to exit] :    VioLETS ARE    Blue 
Enter line [CR to exit] :    and Blue ARE 
Enter line [CR to exit] :
	roses
	are
	very
	red
	violets
	blue
	and
Finally the program prints out again these tokens, but now in sorted order, i.e.
	and
	are
	blue
	red
	roses
	very
	violets
As a comment at the beginning of your program you should do a case analysis for this problem: problem statement, analysis, design, and testing.