Jump to content

Menu: Difference between revisions

1,045 bytes added ,  12 years ago
Added Modula-2 code.
(added OpenEdge solution)
(Added Modula-2 code.)
Line 740:
end
</lang>
 
=={{header|Modula-2}}==
<lang Modula-2>MODULE Menu;
 
FROM InOut IMPORT WriteString, WriteCard, WriteLn, ReadCard;
 
CONST StringLength = 100;
MenuSize = 4;
 
TYPE String = ARRAY[0..StringLength-1] OF CHAR;
 
VAR menu : ARRAY[0..MenuSize] OF String;
selection, index : CARDINAL;
 
BEGIN
menu[1] := "fee fie";
menu[2] := "huff and puff";
menu[3] := "mirror mirror";
menu[4] := "tick tock";
FOR index := 1 TO HIGH(menu) DO
WriteString("[");
WriteCard( index,1);
WriteString( "] ");
WriteString( menu[index]);
WriteLn;
END;(*of FOR*)
WriteString("Choose what you want : ");
ReadCard(selection);
IF (selection <= HIGH(menu)) AND (selection > 0) THEN
WriteString("You have chosen: ");
WriteString( menu[selection]);
WriteLn;
ELSE
WriteString("Selection is out of range!");
WriteLn;
END (*of IF*)
END Menu.</lang>
 
=={{header|MUMPS}}==
<lang MUMPS>MENU(STRINGS,SEP)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.