lecture21 Ada3

lecture21 Ada3 - Ada III Subprogram with Ada.Text_IO; use...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Ada III
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Subprogram with Ada.Text_IO; use Ada.Text_IO; procedure Proced1 is procedure Write_A_Line is begin Put("This is a line of text."); New_Line; end Write_A_Line; begin Write_A_Line; Write_A_Line; end Proced1;
Background image of page 2
Output -- Result of execution -- This is a line of text. -- This is a line of text.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Three Procedures with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Proced2 is Counter : INTEGER; procedure Write_A_Header is begin Counter := 1; Put("This is the heading for this little program."); New_Line(2); end Write_A_Header; procedure Write_And_Increment is begin Put("This is line number"); Put(Counter, 2); Put_Line(" of this program."); Counter := Counter + 1; end Write_And_Increment;
Background image of page 4
procedure Write_An_Ending_Statement is begin New_Line; Put_Line("This is the end of this little program."); end Write_An_Ending_Statement; begin Write_A_Header; for Index in 1. .7 loop Write_And_Increment; end loop; Write_An_Ending_Statement; end Proced2;
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Output -- Result of execution -- This is the heading for this little program. -- -- This is line number 1 of this program. -- This is line number 2 of this program. -- This is line number 3 of this program. -- This is line number 4 of this program. -- This is line number 5 of this program. -- This is line number 6 of this program. -- This is line number 7 of this program. -- -- This is the end of this little program.
Background image of page 6
Global Variables The variable named Counter is a global variable because it is defined prior to any procedure It is therefore available for use by any of these procedures and it is, in fact, used by two of them
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Procedure of Parameters with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Proced3 is Dogs, Cats, Animals : INTEGER; -- This is a procedure specification procedure Total_Number_Of_Animals(Variety1 : in INTEGER; Variety2 : in INTEGER; Total : out INTEGER); -- This is a procedure body procedure
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

lecture21 Ada3 - Ada III Subprogram with Ada.Text_IO; use...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online