It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

English to French/German translator

Moderator: dafunkymunky

English to French/German translator

Postby sjzimmerle on Tue Mar 24, 2009 8:01 pm

I'm having a hard time understanding the work assigned for a project. I was wondering if anyone would be willing to help me. I thank you in advance.

Rudimentary Translator gives English words and their French and German equivalents. Store these words in a text file and read them into a structure having a member for each language. Write a program that sorts arrays according to the English words. The program should then request an English sentence as input from the keyboard and translate it into French and German. For example, if the English sentence given is MY PENCIL IS ON THE TABLE, the French translation will be MON CRAYON EST SUR LA TABLE, and the German translation will be MEIN BLEISTIFT IST AUF DEM TISCH.

Note: Assume that the only punctuation in the sentence is a period at the end of the sentence. Use a binary search to locate each English word.

The English words and their French and German equivalents.

English French German
YES OUI JA
TABLE TABLE TISCH
THE LA DEM
IS EST IST
YELLOW JAUNE GELB
FRIEND AMI FREUND
SICK MALADE KRANK
MY MON MEIN
LARGE GROS GROSS
NO NON NEIN
HAT CHAPEAU HUT
PENCIL CRAYON BLEISTIFT
RED ROUGE ROT
ON SUR AUF
AUTO AUTO AUTO
OFTEN SOUVENT OFT
sjzimmerle
 
Posts: 1
Joined: Tue Mar 24, 2009 7:23 pm

Re: English to French/German translator

Postby instinct46 on Wed Mar 25, 2009 11:43 am

I'm rubbish without language which aren't computer language so this is just a rough thing. Also I have very limited understanding of Visual Basic, but still.

Urm, I think I understand. The way I would do it is make 3 arrays, an array for each language.

Also create string for well the input of the wanted translated text and one for the finished text. You will need another string for the word of which you are translating.

Then setup a loop so that it searches your string adding each letter it comes to until it finds a space/period(remember not to add the space to your working word string, yet skip the space that it has to just found) and end string. In the loop I would make it add a clause of which if the current thing its looking at it a period, end the loop and add a period & NULL to the finishedstring

Then have an INT for the loop, and each time the loop loops tell it compare against EnglishArray(int) until it finds the word its looking for, and then depending on which language you want to translate to you would tell it to go to e.g. FrenchArray(int) and put into 'FinishString' and also add a space unless its the end.

very rough but should give you a good idea of what to do.
User avatar
instinct46
50+ Club
 
Posts: 90
Joined: Tue Mar 27, 2007 1:07 pm
Location: St Helens, England


Who is online

Users browsing this forum: No registered users and 7 guests