Как один из вариантов для аниглийской клавиатуры: | Код | function getnear(bukva:char):string; const ch:array[1..3,1..10] of char =(('q','w','e','r','t','y','u','i','o','p') ,('a','s','d','f','g','h','j','k','l',';') ,('z','x','c','v','b','n','m',',','.','/')); var i,j:byte; begin result:=''; if bukva=ch[1,1] then result:=ch[1,2]+ch[2,1]+ch[2,2]; if bukva=ch[2,1] then result:=ch[2,2]+ch[3,1]+ch[3,2]+ch[1,1]+ch[1,2]; if bukva=ch[3,1] then result:=ch[3,2]+ch[2,1]+ch[2,2]; if bukva=ch[1,10] then result:=ch[1,9]+ch[2,10]+ch[2,9]; if bukva=ch[2,10] then result:=ch[2,9]+ch[3,10]+ch[3,9]+ch[1,10]+ch[1,9]; if bukva=ch[3,10] then result:=ch[3,9]+ch[2,10]; if result<>'' then exit; for i:=1 to 3 do for j:=2 to 9 do if bukva=ch[i,j] then begin if i=1 then begin result:=ch[i,j-1]+ch[i,j+1]+ch[2,j-1]+ch[2,j]+ch[2,j+1]; exit; end; if i=2 then begin result:=ch[1,j-1]+ch[1,j]+ch[1,j+1]+ch[i,j-1]+ch[i,j+1]+ch[3,j-1]+ch[3,j]+ch[3,j+1]; exit; end; if i=3 then begin result:=ch[2,j-1]+ch[2,j]+ch[2,j+1]+ch[i,j-1]+ch[i,j+1]; exit; end; end; end;
|
|