What function or statement to use in Qbasic to breakdown a string value (sentence) word by word?

Hi. I’ve been trying for days to write a program for homework titled “Rudimentary Translator” for my CS class.

Purpose: A user enters a sentence in English, and the program translates it into French and German.

I have already done the parallel arrays on each language using dim, read/data, and for/next loops.

[expected sample run]

Enter an english sentence: MY PENCIL IS ON THE TABLE.

French translation: MON CRAYON EST SUR LA TABLE.

German translation: MEIN BLEISTIFT IST AUF DEM TISCH.

Here is the unfinished code I’ve made. Forgive me if it’s lousy.

CLS

‘Program to sort English, French, German and to translate a given sentence

‘to two of the oter language.

DIM ENGLISH$(), FRENCH$(), GERMAN$()

FOR G = TO

READ ENGLISH$(G), FRENCH$(G), GERMAN$(G)

NEXT G

FOR engsort = TO ( – )

FOR e = TO ( – )

IF ENGLISH$(e) > ENGLISH$(e + ) THEN

SWAP ENGLISH$(e), ENGLISH$(e + )

SWAP FRENCH$(e), FRENCH$(e + )

SWAP GERMAN$(e), GERMAN$(e + )

END IF

NEXT e

NEXT engsort

DO

INPUT “Enter an English phrase: “, userEng$

LET userEng$ = UCASE$(userEng$)

FOR t = TO

IF userEng$ = ENGLISH$(t) THEN

PRINT FRENCH$(t), GERMAN$(t)

END IF

NEXT t

LOOP UNTIL userEng$ = “”

DATA “YES”,”OUI”,”JA”

DATA “TABLE”,”TABLE”,”TISCH”

DATA “THE”,”LA”,”DEM”

DATA “IS”,”EST”,”IST”

DATA “YELLOW”,”JAUNE”,”GELB”

DATA “FRIEND”,”AMI”,”FREUND”

DATA “SICK”,”MALADE”,”KRANK”

DATA “MY”,”MON”,”MEIN”

DATA “LARGE”,”GROS”,”GROSS”

DATA “NO”,”NON”,”NEIN”

DATA “HAT”,”CHAPEAU”,”HUT”

DATA “PENCIL”,”CRAYON”,”BLEISTIFT”

DATA “RED”,”ROUGE”,”ROT”

DATA “ON”,”SUR”,”AUF”

DATA “AUTO”,”AUTO”,”AUTO”

DATA “OFTEM”,”SOUVENT”,”OFT”

END

I appreciate the help you guys can give. Thank you.

Answer
? Favorite Answer

  • PRINT RIGHT$(A$,)

  • Other Related Questions

    Learning Visual Basic ?

    Answers Favorite AnswerTry using "System.Diagnostics.Process. GetProcessesByName( "iwmp" ).Length > " for your check.

    Microsoft Office word Fast answer needed its urgent?
    See also  Is there a shape that your not able to create using auto CAD?

    Answers Favorite AnswerTry this:http://www.techsupport.com///microsoft-wo...Here is another thread re: the same issue with instructions:http://www.pcreview.co.uk/forums/modification-not-...http://www.techsupport.com///microsoft-wo...http://support.microsoft.com/kb/http://answers.microsoft.com/en-us/office/forum/of...

    Can I download a whole city android google maps?

    Answers Favorite Answer:) Yes!!!Interesting question. I wonder why it has blocked in this way especially considering that Google Earth is very detailed and has good maps of Israel.

    What is meant by ROM ? Explain in simple but elaborate terms.What about mobile ROM’s?

    Answers Favorite AnswerHi Diva below is a link that will give a simple answer.http://wiki.answers.com/Q/What_does_ROM_stand_for_...Hope this helps.Source(s): Experience and wiki answers.ROM is Read only memory. i.e data can write only once.There two types of ROM..ROM.PROMThe difference between ROM and PROM.that is ROM is programmed during manufacturing it means data stored by manufacturing company.PROM is blank memory that a user programmable memory.user can store content on PROM.both ROM and PROM are Read only memory Data can write only once.and its not possible to write so many time.Memories of PROM and ROM are Non-volatile in nature. Its that stored informations can retain even power goes off.

    Leave a Comment