I've to go pretty soon, but I think this will do the trick...
Code:
int main()
{
char english[80];
char * pEnglish;
int i;
printf("Enter English word: ");
gets(english);
// Tokenize the string using " "
pEnglish = strtok (english, " ");
while (strcmp (pEnglish, "") != 0)
{
/*look up the word */
i = 0;
/*search while null string not yet encountered */
while(strcmp(words[i][0], "")) {
if(!strcmp(pEnglish, words[i][0])){
printf("German translation: %s", words[i][1]);
break;
}
i++;
}
pEnglish = strtok (NULL, " ");
}
if(!strcmp(words[i][0], ""))
printf("not in dictionary\n");
}
Ehhe, I misunderstood your question before, but I feel like this post I wrote is a pretty good insight in how one gets around the bigger problems of language translation...
You have to write a parser.
I don't really have experience with this, but I do know that this is basically the same problem as writing a program that can decide whether or not a sentence is in correct english.
The idea is that to check the sentence, you have to split it up into groups of words. For example, we might split a sentence into a subject and a predicate, and then we have to figure out a way to figure out to test if the subject is correctly, and then check to see if the predicate is correct.
And to check the subject (or predicate) you would also have to split that into smaller groups of words. For example, the subject might be split into an article, an adjective group, and a noun.
At some point, you will have a group that you cannot split anymore. For example, articles cannot be split, since an article is just one word.
Once you have the sentence divided up like this, you can (hopefully) just swap the groups around to get the right order.