home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog4 / enumrep.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  695 b   |  31 lines

  1.                                     -- Chapter 30 - Program 4
  2. with Text_IO;
  3. use Text_IO;
  4. procedure EnumRep is
  5.  
  6.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  7.    use Int_IO;
  8.  
  9.    type MOTION is (STOPPED, NORTH, EAST, SOUTH, WEST);
  10.    for  MOTION use (STOPPED => 0,
  11.                     NORTH   => 1,
  12.                     EAST    => 2,
  13.                     SOUTH   => 4,
  14.                     WEST    => 8);
  15.  
  16.    Robot_Direction : MOTION := STOPPED;
  17.  
  18. begin
  19.  
  20.    Robot_Direction := MOTION'LAST;                    -- WEST
  21.    Robot_Direction := MOTION'PRED(Robot_Direction);   -- SOUTH
  22.  
  23. end EnumRep;
  24.  
  25.  
  26.  
  27.  
  28. -- Result of execution
  29.  
  30. -- (There is no output from this program)
  31.