November 09, 2024, 03:12:49 AM

Making a lexicon program in baisc

Started by Kommandotolken, November 17, 2016, 12:05:55 AM

Previous topic - Next topic

Kommandotolken

Hello everyone! I am a beginner at this and have a hard time getting my program to work. I want to make a program, that to a start, prints out 10 japanese words randomly.
I guess that you should declare an array and put the words into it.

dim words$(10)
words$(0) = "Arigatou"
words$(1) = "genkidesu"
..... etc etc
..... etc etc
words$(9) = "douitashimashite"

Now, there should be some kind of seed that will be randomized at start up. It will print a different word at every start. How will I make this part? Also, is the string array declared correctly? Best regards!

KeesZagers

The array is declared correctly. That should work.
Before you use the random function you reset the random generator, otherwise you will always get the random numbers in the same order with every run. You do that by:

RANDOMIZE TIMER

After that you can get a random number from 0 to 9 by:

x=INT(10*RND)

To prevent words coming more than once, you have write some utility where you store the numbers you already had, or change the order of the array by skipping the word you have had and decrement the value of 10 in the RND statement. Whatever you like.