requestHelp needed with Eiffel program using hashed_dictionary

I can't seem to get my program to setup the hashed dictionary correctly. It seems to keep the last entry in, and references every key to that entry.

 

I want the method to take in each word from the file, get a sorted version of that word and add it to the dictionary. It gets added in a set of words that have the same key (sorted version). If the sorted version of the word has been met before then we add it to the set referenced by that word, else we create a new set with that word and add it to the dictionary with the sorted word as a key.

Help needed urgently :(

0
Your rating: None

Comments

You're storing a REFERENCE in

berend's picture

You're storing a REFERENCE in they array, i.e. last_string is exactly that: the last_string read.

The solution is:

 

Syndicate content