السلام عليكم
هذا سؤالي :
write a program that takes in words from the console and inserts them into an alphabetizing data structure which is a linked list class. To
facilitate user interaction your program is to print a command prompt. Then it will take four possible commands from the user. Your program should loop on the prompt until the user types exit as described below.
> add *word*
where add is a keyword to your program and *word* gets inserted into your list.
> size
where size is a keyword to your program. Your program should determine the number of elements in the list and return this to the console.
where print is a keyword to your program and causes your program to print out the words in the list
> exit
where exit is a keyword to your program and causes your program to terminate.
A sample run of the program is as follows. Your program should produce identical output if given identical input.
> size
There are 0 words in the database.
> add foo
> add C++
> add list
> size
There are 3 words in the database.
> add foo
> size
There are 4 words in the database.
C++ foo foo list
> exit
Operations on the linked list are (you are to use this interface):
void insert(char* word); //Adds a word to the list.
void printList(); //Prints each element in the list in lexicographical order.
int getCount(); //Returns the number of words in the list