program random_words; uses crt; const MAX_LETTERS = 9; WORDS_PER_PAGE = 10; ESCAPE = #27; alpha : array[1..26] of char = ('a','e','i','o','u','b','c','d','f','g','h','k','l', 'm','n','p','r','s','t','j','q','v','w','x','y','z'); type wordtype = string[MAX_LETTERS]; procedure display_text; begin gotoxy(34,7); textcolor(5); write('Random Words'); textcolor(1); gotoxy(30,8); write('Press Escape to exit'); textcolor(black); end; function random_limits(min,max : byte) : byte; var rnd : byte; begin repeat rnd := random(max+1); until rnd >= min; random_limits := rnd; end; procedure clrwin(x1,y1,x2,y2 : integer); begin window(x1,y1,x2,y2); clrscr; window(1,1,80,25); end; procedure make_random_word(var word : wordtype); var m,rnd,letter : byte; no_of_letters : byte; begin word := ''; no_of_letters := random_limits(3,MAX_LETTERS); for m := 1 to no_of_letters do begin rnd := random_limits(1,20); case rnd of 1..8 : letter := random_limits(1,5); 9..17 : letter := random_limits(6,19); 18..20 : letter := random_limits(20,26); end; word := word + alpha[letter]; end; end; procedure display_word(word : wordtype; var row : byte); begin textcolor(3); gotoxy(36,row); write(word); inc(row,1); textcolor(black); end; var i,row : byte; word : wordtype; pause : char; begin textmode(80); randomize; display_text; while pause <> ESCAPE do begin clrwin(36,10,46,20); row := 10; for i := 1 to WORDS_PER_PAGE do begin make_random_word(word); display_word(word,row); end; pause := readkey; end; textcolor(lightgray); clrscr; end.