How can i randomize words that i have put into an array
so for example if an array has the words:
hi
bye
what

how would i make it say a random one?
THANK YOU

Hi,

I don't know the difference between Pascal and Watcom Pascal, but this code works for pascal:

var
  i : integer;
begin
  randomize;
  i := random(3) + 1;// +1 because random returns a number between 0 and n-1, and arrays in pascal go from 1 to n
  writeln(array[i]);

end.

Cheers,
Ionut

It didnt work in my watcom pascal.
wpas

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.