Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
14
Task/Loops-Foreach/Ada/loops-foreach-1.adb
Normal file
14
Task/Loops-Foreach/Ada/loops-foreach-1.adb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
with Ada.Integer_Text_IO;
|
||||
use Ada.Integer_Text_IO;
|
||||
|
||||
procedure For_Each is
|
||||
|
||||
A : array (1..5) of Integer := (-1, 0, 1, 2, 3);
|
||||
|
||||
begin
|
||||
|
||||
for Num in A'Range loop
|
||||
Put( A (Num) );
|
||||
end loop;
|
||||
|
||||
end For_Each;
|
||||
3
Task/Loops-Foreach/Ada/loops-foreach-2.adb
Normal file
3
Task/Loops-Foreach/Ada/loops-foreach-2.adb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for Item of A loop
|
||||
Put( Item );
|
||||
end loop;
|
||||
25
Task/Loops-Foreach/Ada/loops-foreach-3.adb
Normal file
25
Task/Loops-Foreach/Ada/loops-foreach-3.adb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists;
|
||||
use Ada.Integer_Text_IO, Ada.Containers;
|
||||
|
||||
procedure Doubly_Linked_List is
|
||||
|
||||
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
|
||||
use DL_List_Pkg;
|
||||
|
||||
procedure Print_Node (Position : Cursor) is
|
||||
begin
|
||||
Put (Element (Position));
|
||||
end Print_Node;
|
||||
|
||||
DL_List : List;
|
||||
|
||||
begin
|
||||
|
||||
DL_List.Append (1);
|
||||
DL_List.Append (2);
|
||||
DL_List.Append (3);
|
||||
|
||||
-- Iterates through every node of the list.
|
||||
DL_List.Iterate (Print_Node'Access);
|
||||
|
||||
end Doubly_Linked_List;
|
||||
25
Task/Loops-Foreach/Ada/loops-foreach-4.adb
Normal file
25
Task/Loops-Foreach/Ada/loops-foreach-4.adb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
with Ada.Integer_Text_IO, Ada.Containers.Vectors;
|
||||
use Ada.Integer_Text_IO, Ada.Containers;
|
||||
|
||||
procedure Vector_Example is
|
||||
|
||||
package Vector_Pkg is new Vectors (Natural, Integer);
|
||||
use Vector_Pkg;
|
||||
|
||||
procedure Print_Element (Position : Cursor) is
|
||||
begin
|
||||
Put (Element (Position));
|
||||
end Print_Element;
|
||||
|
||||
V : Vector;
|
||||
|
||||
begin
|
||||
|
||||
V.Append (1);
|
||||
V.Append (2);
|
||||
V.Append (3);
|
||||
|
||||
-- Iterates through every element of the vector.
|
||||
V.Iterate (Print_Element'Access);
|
||||
|
||||
end Vector_Example;
|
||||
Loading…
Add table
Add a link
Reference in a new issue