Ferramentas de Usuário

Ferramentas de Site


dev_geral:pascal:snippet:menu_exemplo

Menu (exemplo)

program menu;
uses crt;
var a :integer ;
    k: char;
 
procedure p1;
begin
     clrscr;
     writeln('LOL1');
     readkey;
end;
 
procedure p2;
begin
     clrscr;
     writeln('LOL2');
     readkey;
end;
 
procedure p3;
begin
     clrscr;
     writeln('LOL3');
     readkey;
end;
 
procedure p4;
begin
     clrscr;
     writeln('LOL4');
     readkey;
end;
 
procedure p5;
begin
     clrscr;
     writeln('LOL5');
     readkey;
end;
 
begin
     repeat
           repeat
                 clrscr;
                 gotoxy(20,10);
                 writeln('############### <- MENU -> ###############');
                 for a := 11 to 24 do begin
                     gotoxy(20,a);
                     writeln('#');
                 end;
                 for a:= 11 to 24 do begin
                     gotoxy(61,a);
                     writeln('#');
                 end;
                 gotoxy(20,25);
                 writeln('##########################################');
                 gotoxy(22, 12);
                 writeln('1 - Opcao 1 ');
                 gotoxy(22, 13);
                 writeln('2 - Opcao 2 ');
                 gotoxy(22, 14);
                 writeln('3 - Opcao 3 ');
                 gotoxy(22, 15);
                 writeln('4 - Opcao 4 ');
                 gotoxy(22, 16);
                 writeln('5 - Opcao 5 ');
                 gotoxy(22,17);
                 writeln('6 - Sair');
                 gotoxy(50,18);
                 write('Opcao: ');
                 gotoxy(56,18);
                 k := readkey;
           until (k >= '1') and (k <= '6');
           case k of
                '1' : p1;
                '2' : p2;
                '3' : p3;
                '4' : p4;
                '5' : p5;
           end;
     until k = '6';
end.
dev_geral/pascal/snippet/menu_exemplo.txt · Última modificação em: 2018/05/14 21:37 (edição externa)