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

  1.                                        -- Chapter 8 - Program 3
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Proced3 is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    Dogs, Cats, Animals : INTEGER;
  11.  
  12.                              -- This is a procedure specification
  13.    procedure Total_Number_Of_Animals(Variety1 : in     INTEGER;
  14.                                      Variety2 : in     INTEGER;
  15.                                      Total    :    out INTEGER);
  16.  
  17.                              -- This is a procedure body
  18.    procedure Total_Number_Of_Animals(Variety1 : in     INTEGER;
  19.                                      Variety2 : in     INTEGER;
  20.                                      Total    :    out INTEGER) is
  21.    begin
  22.       Total := Variety1 + Variety2;
  23.    end Total_Number_Of_Animals;
  24.  
  25. begin
  26.    Dogs := 3;
  27.    Cats := 4;
  28.    Total_Number_Of_Animals(Dogs,Cats,Animals);
  29.    Put("The total number of animals is");
  30.    Put(Animals);
  31.    New_Line;
  32. end Proced3;
  33.  
  34.  
  35.  
  36.  
  37. -- Result of execution
  38.  
  39. -- The total number of animals is     7
  40.  
  41.