Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!crackers!m2c!wpi.WPI.EDU!kamal From: kamal@wpi.WPI.EDU (Kamal Z Zamli) Newsgroups: comp.lang.pascal Subject: Re: Reuqest : Help with Enumeration Types Keywords: enumeration type Message-ID: <1990Dec10.180345.31492@wpi.WPI.EDU> Date: 10 Dec 90 18:03:45 GMT References: <3983@uniol.UUCP> Organization: Worcester Polytechnic Institute Lines: 40 In article <3983@uniol.UUCP> Arne.Gehlhaar@arbi.informatik.uni-oldenburg.de (Arne Gehlhaar) writes: >Hi > >I have a problem with enumeration types. I want to declare a type "measures" >as a list of measurements: (g,kg,lb,oz, etc.) the actual type declaration is >no problem, but I am not allowed to do input/output with them (says the >Turbo Pascal 4.0 compiler) So what is the use of those types. Can anyone >help me ?? What do I have to do in order for the compiler to accept input >and output ? > It is the rule of PASCAL that you can't do input/output with enumerated data type......but you can get away with it by using the common data type i.e integer, char.... for instance , consider the following example: (* demo program for enumerated data type *) program Enumerated; type Symbol=(Kg,Inch,Ib); var Measurement:Symbol; Choice:char; begin Writeln (' Choose between kg,Inch,Ib'); Readln (Choice); Case Choice of 'K','k':Measurement:=Kg; 'L','l':MEasurement:='Ib'; 'I','i':Measurement:='Inch'; end (*case *) end. (* program *) I hope this helps.....