I Need Help Sorting A Structure Array ....

bdeitsch
02-01-2004, 01:33 AM
Help,

I am trying to build a language translator application. I have 16 words in English, French, and German. My application asks the user to input a sentence using the 16 words available. The application will then break the sentence down into individual words. I started to set up 3 different arrays, one for each language, but that didn't work so well. When I searched for a matching word in the English array, and use that words index to find its matching word in the French and German arrays and then display the words, I get nothing. I then tried to use a binarysearch to search the English array, get the words index, and then display the matching word from the other two array with the same index, but I get nothing but negative numbers from the binarysearch. Then I remembered, that I have to sort the array before binarysearch will work, so I sort the English array. Then the words in English didn't match the words in the other two. So I figure I have to set up a structure, called Words, and have 3 sub elements of this structure, called English, French, and German. But I have no idea how to search Words.English for a word and use that to find and display the Word.French and Word.German words. Nothing that I am doing is working. Can anyone help??? I'm down to my last 7 or 8 hairs on my head and I'm about to pull them out too. Thank you

Bdeitsch

VBJoe
02-01-2004, 10:05 PM
I'm not sure I understand exactly what you're doing, but this is what I'd do (based on my interpretation of your post).

1) Create a Class that contains 3 properties (Word.vb):
-A) .English
-B) .German
-C) .French
2) Overload the .ToString method to return the English representation of the word (or better yet, have another property that flags which language should be returned).
3) Create a Collection that can be filled with Word objects, using the English version of the word as the Key value.
4) Instead of "sorting" the values, you'd only need to use the Key value of the object to get the French and German versions of the word out of the Collection.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum