Some updates.

This commit is contained in:
Tomasz Półgrabia 2025-03-09 11:58:55 +01:00
parent a0b3856c69
commit c019a5a884
57 changed files with 2026 additions and 0 deletions

View file

@ -0,0 +1,9 @@
all: hello
hello: hello.adb
gnatmake hello.adb
.PHONY: clean
clean:
rm -f *.ali *.o hello

View file

@ -0,0 +1,61 @@
with Ada.Text_IO;
use Ada.Text_IO;
with Ada.Command_Line;
use Ada.Command_Line;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
procedure Hello is
package IO renames Ada.Text_IO;
i: Integer := 2;
j: Integer := 1;
k: Integer;
procedure Add (A, B: in Integer; C: out Integer) is
begin
C := A + B;
end Add;
function Subtract(A, B: Integer) return Integer is
begin
return A - B;
end Subtract;
function Factorial(X: Integer) return Integer is
begin
if x <= 1 then
return 1;
end if;
return X * Factorial(X-1);
end Factorial;
begin
Put_Line("Hello, world");
Add(i,j,k);
k := Subtract(k,1);
case k is
when 1 =>
Put_Line("i ma wartosc 1");
when 2 =>
Put_Line("i ma wartosc 2");
when 3 =>
Put_Line("i ma wartosc 3");
when others =>
Put_Line("i ma niespotykaną wartość");
end case;
New_Line(1);
Put("Ala ma ");
Put(Factorial(5),0);
Put(" kotów");
New_Line;
K := Integer(2.4);
Put("Skonwertowane 2.5 to: ");
Put(K,0);
New_Line;
end Hello;