Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
with Ada.Text_Io;
|
||||
procedure CompileTimeCalculation is
|
||||
Factorial : constant Integer := 10*9*8*7*6*5*4*3*2*1;
|
||||
|
||||
begin
|
||||
Ada.Text_Io.Put(Integer'Image(Factorial));
|
||||
end CompileTimeCalculation;
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
with Ada.Text_Io;
|
||||
procedure CompileTimeCalculation is
|
||||
|
||||
function Factorial (Int : in Integer) return Integer is
|
||||
begin
|
||||
if Int > 1 then
|
||||
return Int * Factorial(Int-1);
|
||||
else
|
||||
return 1;
|
||||
end if;
|
||||
end;
|
||||
|
||||
Fact10 : Integer := Factorial(10);
|
||||
begin
|
||||
Ada.Text_Io.Put(Integer'Image(Fact10));
|
||||
end CompileTimeCalculation;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
procedure Unbounded_Compile_Time_Calculation is
|
||||
F_10 : constant Integer := 10*9*8*7*6*5*4*3*2*1;
|
||||
A_11_15 : constant Integer := 15*14*13*12*11;
|
||||
A_16_20 : constant Integer := 20*19*18*17*16;
|
||||
begin
|
||||
Ada.Text_IO.Put_Line -- prints out
|
||||
("20 choose 10 =" & Integer'Image((A_11_15 * A_16_20 * F_10) / (F_10 * F_10)));
|
||||
-- Ada.Text_IO.Put_Line -- would not compile
|
||||
-- ("Factorial(20) =" & Integer'Image(A_11_15 * A_16_20 * F_10));
|
||||
end Unbounded_Compile_Time_Calculation;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Ada.Text_IO.Put_Line -- would not compile
|
||||
("Factorial(20) =" & Integer'Image(A_11_15 * A_16_20 * F_10));
|
||||
Loading…
Add table
Add a link
Reference in a new issue