- Jan 30, 2001
- 2,060
- 0
- 76
Here's my problem, and perhaps it's a dumb one. Just got done playing around with pointers, and our CS teacher gave us a project in which we're supposed to make a dictionary program. Now, I've got 99.9% of it all finished, but one problem. He gave us a very strict guideline for how to do it. Oh, and by the way, this is c++ we're dealing with.
1) We're ONLY allowed to use linked lists, and we can only define them once(This would be easy for me because I already know vectors and templates, but we can't use them)
2) we have a class Entry with private members word and definition.
3) we have a typedef dictionary, which is a linked list of entries (Okay, so we're officially forced to declare our list of type Entry)
4) Definition is actually a linked list itself, made up of mulitple lines of definitions read out of a file
Okay, so normally if I had declared a list of type string, I could go, say, node->item= string. Unfortunetly, item now is an entry, which has 2 data members.
Now, the next trick comes into play. We're doing this in teams to expriance modularity and true programing, and I'm only allowed to touch the big linked lists. My initial thought was to use a constructor, like node->item= entry b (word, def), but I don't have the right to make the constructor, which makes me believe there is another way. Any advice?
 
				
		 
			 
 
		 
 
		 
 
		 
	 
 
		 
 
		 
 
		 
 
		
 Facebook
Facebook Twitter
Twitter