text stringlengths 0 234 |
|---|
--Put( InputLine(I) ); |
--Put(" === "); |
--Put( Character'Pos( InputLine(I) ) ); |
--New_Line; |
end case; |
end if; |
end loop; |
-- Put_Line (Output, Line); |
--Put(Line); |
--Skip_Line; |
Function Definition: procedure Lab4e is |
Function Body: type Dates is array (1..10) of Date_Type; |
procedure Sort(Arrayen_Med_Talen: in out Dates) is |
procedure Swap(Tal_1,Tal_2: in out Date_Type) is |
Tal_B : Date_Type; -- Temporary buffer |
begin |
Tal_B := Tal_1; |
Tal_1 := Tal_2; |
Tal_2 := Tal_B; |
-- DEBUG New_Line; Put("SWAP IS RUNNING! INDEXES INPUT: "); Put(Tal_1); Put("+"); Put(Tal_2); New_Line; |
end Swap; |
Minsta_Talet: Date_Type; |
Minsta_Talet_Index: Integer; |
begin |
--Minsta_Talet.Year := 0; |
--Minsta_Talet.Month := 0; |
--Minsta_Talet.Day := 0; |
-- -- Loopa antalet gånger som arrayens längd |
for IOuter in Arrayen_Med_Talen'Range loop |
-- -- DEBUG Put("> "); Put(IOuter); Put(" <"); New_Line; |
-- -- Loopa arrayen med start från yttra loopens värde varje gång. 1..20, 2..20, ... , 20..20 |
for I in IOuter..Arrayen_Med_Talen'Last loop |
-- --DEBUG Put(">>>"); Put(I); New_Line; |
if I = IOuter or Arrayen_Med_Talen(I) < Minsta_Talet then |
Minsta_Talet := Arrayen_Med_Talen(I); |
Minsta_Talet_Index := I; |
end if; |
end loop; |
-- |
Swap(Arrayen_Med_Talen(IOuter), Arrayen_Med_Talen(Minsta_Talet_Index)); |
-- --DEBUG New_Line; Put("Vi swappar "); Put(Iouter); Put(" och "); Put(Minsta_Talet_Index); New_Line; |
end loop; |
end Sort; |
procedure Test_Get(Date: out Date_Type) is |
begin |
loop |
begin |
Get(Date); |
exit; |
exception |
when YEAR_ERROR => Put_Line("FEL: YEAR_ERROR"); |
when MONTH_ERROR => Put_Line("FEL: MONTH_ERROR"); |
when DAY_ERROR => Put_Line("FEL: DAY_ERROR"); |
when FORMAT_ERROR => Put_Line("FEL: FORMAT_ERROR"); |
Function Definition: procedure Lab4a is |
Function Body: type Dates is array (1..10) of Date_Type; |
procedure Test_Get(Date: out Date_Type) is |
begin |
loop |
begin |
Get(Date); |
exit; |
exception |
when YEAR_ERROR => Put_Line("FEL: YEAR_ERROR"); |
when MONTH_ERROR => Put_Line("FEL: MONTH_ERROR"); |
when DAY_ERROR => Put_Line("FEL: DAY_ERROR"); |
when FORMAT_ERROR => Put_Line("FEL: FORMAT_ERROR"); |
Function Definition: procedure Lab4 is |
Function Body: type Dates is array (1..10) of Date_Type; |
procedure Sort(Arrayen_Med_Talen: in out Dates) is |
procedure Swap(Tal_1,Tal_2: in out Date_Type) is |
Tal_B : Date_Type; -- Temporary buffer |
begin |
Tal_B := Tal_1; |
Tal_1 := Tal_2; |
Tal_2 := Tal_B; |
-- DEBUG New_Line; Put("SWAP IS RUNNING! INDEXES INPUT: "); Put(Tal_1); Put("+"); Put(Tal_2); New_Line; |
end Swap; |
Minsta_Talet: Date_Type; |
Minsta_Talet_Index: Integer; |
begin |
--Minsta_Talet.Year := 0; |
--Minsta_Talet.Month := 0; |
--Minsta_Talet.Day := 0; |
-- -- Loopa antalet gånger som arrayens längd |
for IOuter in Arrayen_Med_Talen'Range loop |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.