Kreiranje menija sa while uslovom

 

umjesto bezuslovnog skoska prerporučuje se korišćenje uslovnoe petlje

 

 

program WHILEmeni;
uses wincrt;
Var Sel: String;
var yn:char;

Begin
YN:='n';

 

WHILE YN<>'Y' DO
begin

Clrscr;
Writeln('Za Meni1 ukucaj-izaberi 1; ako zelis Meni2 ukucaj 2; za kraj- izaberi/ukucaj 3');
writeln;
Writeln('1.IZBOR meni1 2.IZBOR meni2 3.Izbor KRAJ-Exit');
writeln;
Write('Select: ');
Sel := Readkey;

If Sel = '1' {action} then
  Begin {more than one statement}
  ClrScr;
  Write('1-izbor -MENI 1');
  Write('Moguc niz naredbi11');
  writeln ;
  Write('Za povratak u glavni meni pritisni bilo koji taster');
  Readkey;
End; {Closing the if sel1 statement(begin)}

If Sel = '2' then {note that the assignment statement is not used within an if statement}
 Begin {more than one statement}
 ClrScr;
 Write('2-izbor -MENI 2');
 Write('Moguc niz naredbi2222');
 writeln;
 Write('Za povratak u glavni meni pritisni bilo koji taster');
 Readkey;
End; {Closing the if sel2 statement(begin)}

If Sel = '3' then
Begin
 ClrScr;
 Write('Are you sure?(Y/N)');
 YN := Readkey;
 Writeln(YN);
 READLN;
 If (YN = 'y') or (YN ='Y') then Halt {1 action, so no need of Begin..End}
End;

End
end.

 

Na start Informatika

copyright M2M
BL-2011-13