Написать меню горизонтальное, чтобы по нему можно было перемещаться стрелками и входить по нажатию Enter- Pascal(Паскаль)

uses crt;
const Kol=9;
type mas = array [1..Kol] of string[20];
const stor: mas = ('  1  ','  2   ','  3  ','  4  ','  5  ','  6  ','  7  ','  8  ','Vyxod');
var i,k : byte;
procedure PrintMenu(var k: byte);
var kod: char;
begin
clrscr;
k:=1;
gotoxy(4,1);
K :=1;
repeat
  for i:=1 to Kol do
   begin
     if I=K then
      begin
         textbackground(3);
         textcolor(12);
      end
     else
      begin
         textbackground(0);
         textcolor(15)
      end;
     gotoxy(5*(i-1)+1,1);
     write(stor[i]);
   end;
  repeat
  kod:=readkey;
  until Kod in [#13, #75, #77];
  case Kod of
  #75: begin  K := K-1; if K = 0 then K := Kol;
       end;
  #77: begin K :=K+1;  if K =10 then K := 1; end;
   end;
 until Kod = #13 ;
 
end;
begin
 repeat
   textbackground(0);
   textcolor(15);
   PrintMenu(K);
   clrscr;
   textbackground(0);
   textcolor(15);
   if k<9 then
    begin
     write('vybran variant ',k); readln;
    end
   else exit;
   case K of
   1: {procedure 1};
   2: {procedure 2};
   end;
 until k = 9;
end.

Leave a Comment

87 − 78 =