with Gada.Text_IO ;
with Rois ;
procedure Mission5 is
package Txt renames GAda.Text_IO ;
procedure Tout_Afficher is
begin
for No in 1..Rois.Nb_Rois loop
Txt.Put_Line(Rois.Nom(No) & " " & Integer'Image(Rois.Debut(No)) & " -" & Integer'Image(Rois.Fin(No))) ;
end loop ;
end Tout_Afficher ;
function Plus_Long return Integer is
Duree_Max : Integer := 0 ;
Numero_Max : Integer ;
Duree : Integer ;
begin
for No in 1..Rois.Nb_Rois loop
Duree := Rois.Fin(No) - Rois.Debut(No) ;
if Duree > Duree_Max then
Duree_Max := Duree ;
Numero_Max := No ;
end if ;
end loop ;
return Numero_Max ;
end Plus_Long ;
LongRoi : Integer ;
begin
Tout_Afficher ;
LongRoi := Plus_Long ;
Txt.Put_Line("Le roi ayant régné le plus longtemps est : " & Rois.Nom(LongRoi)
& " de " & Integer'Image(Rois.Debut(LongRoi))
& " a " & Integer'Image(Rois.Fin(LongRoi))) ;
end Mission5 ;