home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / os2apipm.zip / ADAEXAM / DYNAM.ADB next >
Text File  |  1996-09-06  |  528b  |  21 lines

  1. -- example dynamic array creation
  2. -- this example demonstrate how
  3. -- to create dynamic array of any
  4. -- type in ADA 95
  5.  
  6. with addtype; use addtype;
  7. with text_io; use text_io;
  8. procedure dynam is
  9. type pvect is access all ivector;
  10. p : pvect;
  11. i : integer;
  12. package int_io is new integer_io(integer); use int_io;
  13. begin
  14.  
  15. put(" Enter array length :"); get(i);
  16. p := new ivector(1..i) ;   -- dynamic object creation
  17. for j in 1..i loop p(j) := 2*j; end loop;
  18. new_line;
  19. for j in 1..i loop put(p(j)); end loop;
  20. end dynam;
  21.