Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with Ada.Text_IO; use Ada.Text_IO;
- procedure Hello is
- procedure swap(x, y: in out Integer) is
- tmp: Integer;
- begin
- tmp := x;
- x := y;
- y := tmp;
- end swap;
- type Tablica is array(Integer range <>) of Integer;
- procedure Sort (tab: in out Tablica) is
- begin
- for j in tab'first..tab'last-1 loop
- for i in tab'first..tab'last-1 loop
- if tab(i) > tab(i+1) then
- swap(tab(i), tab(i+1));
- end if;
- end loop;
- end loop;
- for i in tab'first..tab'last-1 loop
- Put_Line (Integer'Image (tab(i)));
- end loop;
- end Sort;
- tab: Tablica(1..10) := (3, 5, 1, 7, 0, 3, 5, 1, 7, 0);
- temp: Integer;
- begin
- Sort(tab);
- end Hello;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement