text stringlengths 0 234 |
|---|
-- -- 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 Lab4d 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 Lab4fg 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; |
end Swap; |
Minsta_Talet: Date_Type; |
Minsta_Talet_Index: Integer; |
begin |
-- Loopa antalet gånger som arrayens längd |
for IOuter in Arrayen_Med_Talen'Range loop |
-- 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 |
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)); |
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 Lab4b 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"); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.