473,659 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Eiffel program please

4 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. dictsetup(h:HASHED_DICTIONARY [HASHED_SET[STRING], STRING]; fname:STRING) is
  2.         local
  3.             in_file: TEXT_FILE_READ;
  4.             t, t0: STRING
  5.         do
  6.             from
  7.                 !!in_file.connect_to(fname)
  8.                 !!set.make
  9.             until
  10.                 in_file.end_of_input
  11.             loop
  12.                 in_file.read_word
  13.                 t := in_file.last_string
  14.                 t.to_lower
  15.  
  16.                 t0 := t.twin
  17.                 sortstring(t0)
  18.  
  19.                 if h.has(t0) then
  20.                     h.at(t0).add(t)
  21.                 else
  22.                     set.clear_count
  23.                     set.add(t)
  24.                     h.put(set,t0)
  25.                 end
  26.  
  27.  
  28.             end
  29.             in_file.disconnect
  30.         end
  31.  
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 :(
Dec 16 '10 #1
0 1240

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3883
by: Roy J | last post by:
Hello everyone:) My name is Roy, I am new to Java and I have problem regarding to arrays. if you have time and like to help, please help. I am trying to make a program to deal with prime numbers, but I do not how to involve arrays with that. program generates prime numbers according to user input, and displays them in descending order. The user enters the number of prime numbers to be generated. The output is displayed 5 numbers per...
1
1436
by: Brent W. Hughes | last post by:
I recently downloaded HelpMaker for free, but there was no documentation with it. Does someone know where I can find such documentation? Or, alternatively, where I can find another good free Help authoring program.? Brent
7
3598
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
4
1518
by: kirill_uk | last post by:
Help with extracting please folks.! Hi. I have this: a variable like: <a href="http://www.some_html.com/text.html" >some text</a><br> I heed to extract the "http://www.some_html.com/text.html " and put it in var "link" And extract "some text" and put it var "text",. So basically extract all between <a href=" and " >
1
2151
by: apacheutara | last post by:
hai.. i juz started learning C++ language & started to try creating a program. its a simple contacts list. here's the code: ========================================================= #include <iostream> using namespace std; #include <string>
5
1370
by: ToAsTeEJaVa | last post by:
I need to repeat a set of instructions but if the user enters a certain character or number e.g. 0; the program should stop... what methods can I use for this? I have tried to use a "for" method but there is no way to break the cycle! and so I have tried a "while" method too but our handbook fails to specify how to stop a program. please help me asap!
6
1567
by: André | last post by:
Hi, I made a webform for a survey, with multiple-choice questions. The results of each question is put into a table e.g.: values frequency 1 6 2 3 3 32 4 26 5 12
5
1729
by: sandyw | last post by:
I need help in two areas: Both are at the bottom of my program where a client has two choice to make, 1. When the client enter "Y" it takes him to the begin of the program. I would like to know what this is done ie maybe at the part where it ask you do you want to enter a new product. 2. If the client enters the wrong value or then "Y" or "N" then they are prompted with "error - Please try again" for some reason my no matter what I enter I...
5
2192
by: mohammaditraders | last post by:
Question # 1 Write a program which consists of a class named Student, the class should consists of three data members Name, Ob_marks, Total_marks and two member functions Cal_percentage() which calculate the percentage of the student by the formula (Ob_marks * 100 )/Total_marks and Display() which show all information of the student. The class should also contain the default constructor which initializes all the data member of...
4
1370
by: isabelle | last post by:
hi, every body.. help me in this program. please!! write a c++ program that converts hexadecimal digit to its corresponding decimal value. input/output: Enter a hexadecimal digit :A The corresponding decimal value:10
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.