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

  1.                                       -- Chapter 11 - Program 5
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure CharInt is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    Char : CHARACTER;
  11.    Index : INTEGER;
  12.    Stuff : array(0..25) of CHARACTER;
  13.  
  14. begin
  15.    Char := 'A';
  16.    Index := 5 + CHARACTER'POS(Char);
  17.    Put(Index);
  18.    Char := CHARACTER'VAL(Index);
  19.    Put(Char);
  20.  
  21.    New_Line;
  22.    Stuff(21) := 'X';
  23.    Index := 2 + CHARACTER'POS(Stuff(21));
  24.    Put(Index);
  25.    Stuff(0) := CHARACTER'VAL(Index);
  26.    Put(Stuff(0));
  27.  
  28. end CharInt;
  29.  
  30.  
  31.  
  32.  
  33. -- Result of execution
  34.  
  35. --     70F
  36. --     90Z
  37.  
  38.