witam czy ktos moze mi pomoc, mam problem z dzialaniem menu wszystko niby dziala ale gdy ma sie wykonac do konca zadanie1 to sie chrzani i przechodzi do menu glownego niemam pojecia co jest zle i niemoge nic znalezc. jezeli ktos by znalazl blad to prosze o odpowiedz
to jest caly kod:
program zal;
uses crt;
procedure Zadanie1;
var
napis:string;
zam,otw:integer;
nr:integer;
begin
clrscr;
write('Podaj napis: ');
read(napis);
zam:=0; otw:=0;
for nr:=1 to length(napis) do
begin
if napis[nr]='(' then otw:=otw+1;
if napis[nr]=')' then zam:=zam+1;
if zam>otw then writeln ('Blad');
end;
if otw=zam then writeln('Nawiasy sa prawidlowe') else writeln('Blad');
readln();
end;
procedure Zadanie2;
begin
end;
procedure pozytyw;
begin
TextBackground(black);
TextColor(red);
end;
procedure negatyw;
begin
TextBackground(red);
TextColor(black);
end;
procedure menu;
var
akt:integer;
kl:char;
begin
clrscr;
akt:=1;
repeat
TextMode(CO80);
TextBackground(black);
repeat
if akt=1 then negatyw else pozytyw;
gotoxy(30,10); write('Zadanie Nr1');
if akt=2 then negatyw else pozytyw;
gotoxy(30,11); write('Zadanie Nr2');
if akt=3 then negatyw else pozytyw;
gotoxy(30,12); write('Wyjscie z programu');
kl:=ReadKey;
case kl of
#72:akt:=akt-1;{do gory}
#80:akt:=akt+1;{w dol}
'1':akt:=1;
'2':akt:=2;
'3':akt:=3;
end;
if akt3 then akt:=1;
until kl=#13;{enter}
case akt of
1:Zadanie1;
2:Zadanie2;
end;
until akt=3;
end;
begin
menu;
end.