with Ada.Text_IO,Ada.Integer_Text_IO;
use Ada.Text_IO,Ada.Integer_Text_IO;
procedure Slice is
type MY_ARRAY is array(1..12) of Integer;
First,Second:MY_ARRAY;
Funny:array(1..33)of Integer;
begin
for Index in 1..33 loop
Funny(Index):=100+Index*2;
end loop;
for Index in 1..12 loop
First(Index):=Index;
end loop;
Second(1..5):=First(3..7);
Second(1..4):=First(6..9);
Second(7..12):=First(3..8);
First(2..9):=First(5..12);
First(1..12):=MY_ARRAY(Funny(1..12));
First(1..12):=MY_ARRAY(Funny(16..27));
for Index in 1..12 loop
Put("The array named First has the values");
Put(First(Index));
New_Line;
end loop;
end Slice;
045.数组间的切片(赋值)
最新推荐文章于 2024-03-25 01:21:13 发布