Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : SETS.MOD

 
Output of file : SETS.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 10 - Program 3 *)
MODULE Sets;

FROM InOut IMPORT WriteString, WriteLn;

TYPE Goodies = (IceCream,WhippedCream,Banana,Nuts,Cherry,
ChocSyrup,StrawBerries,Caramel,SodaWater,
Salt,Pepper,Cone,Straw,Spoon,Stick);

Treat = SET OF Goodies;

VAR Sundae : Treat;
BananaSplit : Treat;
Soda : Treat;
IceCreamCone : Treat;
NuttyBuddy : Treat;
Mixed : Treat;
Index : Treat;

BEGIN
(* Define all ingredients used in each treat *)
IceCreamCone := Treat{IceCream,Cone};
Soda := Treat{Straw,SodaWater,IceCream,Cherry};
BananaSplit := Treat{IceCream..Caramel};
BananaSplit := BananaSplit + Treat{Spoon};
NuttyBuddy := Treat{Cone,IceCream,ChocSyrup,Nuts};
Sundae := Treat{IceCream,WhippedCream,Nuts,Cherry,ChocSyrup,
Spoon};

(* Combine for a list of all ingredients used *)
Mixed := IceCreamCone + Soda + BananaSplit + NuttyBuddy +
Sundae;

(* Now find what ingredients are not used *)

Mixed := Treat{IceCream..Stick} - Mixed;

IF IceCream IN Mixed THEN
WriteString('Ice cream not used');
WriteLn; END;
IF WhippedCream IN Mixed THEN
WriteString('Whipped Cream not used');
WriteLn; END;
IF Banana IN Mixed THEN
WriteString('Bananas not used');
WriteLn; END;
IF Nuts IN Mixed THEN
WriteString('Nuts not used');
WriteLn; END;
IF Cherry IN Mixed THEN
WriteString('Cherries not used');
WriteLn; END;
IF ChocSyrup IN Mixed THEN
WriteString('Chocolate Syrup not used');
WriteLn; END;
IF StrawBerries IN Mixed THEN
WriteString('Strawberries not used');
WriteLn; END;
IF Caramel IN Mixed THEN
WriteString('Caramel not used');
WriteLn; END;
IF SodaWater IN Mixed THEN
WriteString('SodaWater not used');
WriteLn; END;
IF Salt IN Mixed THEN
WriteString('Salt not used');
WriteLn; END;
IF Pepper IN Mixed THEN
WriteString('Pepper not used');
WriteLn; END;
IF Cone IN Mixed THEN
WriteString('Cone not used');
WriteLn; END;
IF Straw IN Mixed THEN
WriteString('Straw not used');
WriteLn; END;
IF Spoon IN Mixed THEN
WriteString('Spoon not used');
WriteLn; END;
IF Stick IN Mixed THEN
WriteString('Stick not used');
WriteLn; END;
END Sets.




(* Result of execution

Salt not used
Pepper not used
Stick not used

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : SETS.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/