Link to home
Start Free TrialLog in
Avatar of catalyst19002800
catalyst19002800

asked on

Dictionary

Create a "dictionary", an array  of word-definition pairs.  
Each element of the array is a struct, and the struct has two
members, a word (maximum 20 letters), and a definition (maximum
200 letters).

Let the user enter a word followed by its definition,
repeatedly.  When the user has entered the word "***", then he
is done.

Once all the words are entered, pass them to a function which
sorts them in alphabetical order.  Don't get the definitions
mixed up during the sort.

Print out the alphabetized list and end
Avatar of imladris
imladris
Flag of Canada image

It is not ethical for us to do your homework for you. We would be willing to help you with specific difficulties, in the same vein as a T.A. would, but you really need to make an effort yourself.

Avatar of catalyst19002800
catalyst19002800

ASKER

I do use your suggested solution as a learning tool and I noramlly have of my own to compare against. However, I also understand your position. As you suggested perhaps I should be more clear with the portion of the problem that I have difficulty with.
I agree with Imladris.   Demonstrate an attempt, post where you are with sample code, and you will get comments, critique, and
pointers back.   But you shouldn't expect us to do your work for you.  
qsort() is your friend.
Just take care with the comparison function.
The only problem i can  see is that the number of words you want to store
in your dictionary is decided by the user (ie it is not preset)
Therfore you should go in for linked lists (if you want to make it simple) or
binary trees (if you want to make it efficient)
if you need more help, get back at rsjetty@hotmail.com
note that the sort function itself has a very minor role in the program
Avatar of ozo
...or realloc (if you want to keep it simple for qsort)
ASKER CERTIFIED SOLUTION
Avatar of Egore
Egore

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial