text
stringlengths
0
234
Get (Genre_Lu);
Skip_Line;
case Genre_Lu is
when 'f' | 'F' =>
Genre := Feminin;
when 'm' | 'M' =>
Genre := Masculin;
when others =>
Genre := Autre;
end case;
Correct := False; -- La date entrée est correcte ?
while not Correct loop
Put ("Date de naissance [au format JJMMAAAA] : ");
begin
Get (Date_Lue);
Date_De_Naissance :=
Creer_Date
(Date_Lue / 1000000, (Date_Lue / 10000) mod 100,
Date_Lue mod 10000);
Correct := True;
exception
when Ada.Io_Exceptions.Data_Error | Date_Incorrecte =>
Correct := False;
Function Definition: procedure Afficher_Menu_Registre_Ajout (Etat : in out T_Etat) is
Function Body: Cle : Integer;
Personne : T_Personne;
Choix : Character;
begin
Put_Line ("* Ajouter une personne au registre *");
New_Line;
Put_Line
("Informations requises : nom usuel, nom complet, sexe, date et lieu de naissance.");
New_Line;
Saisir_Personne (Personne);
Put ("Confirmer l'ajout [O pour oui, autre pour non] : ");
Get (Choix);
Skip_Line;
if Choix = 'o' or Choix = 'O' then
Ajouter_Personne (Etat.Arbre, Personne, Cle);
Put ("Personne ajoutée avec la clé : ");
Put (Cle, 0);
else
Put ("Ajout annulé.");
end if;
New_Line;
New_Line;
Etat.Menu := Menu_Registre;
end Afficher_Menu_Registre_Ajout;
-- Permet de modifier une personne enregistrée.
procedure Afficher_Menu_Registre_Modification (Etat : in out T_Etat) is
Personne : T_Personne;
Choix : Character;
begin
Put_Line ("* Modification d'une personne du registre *");
New_Line;
Put_Line ("Informations actuelles : ");
Personne := Lire_Registre (Etat.Arbre, Etat.Cle);
Afficher_Personne (Etat.Cle, Personne);
New_Line;
Saisir_Personne (Personne);
New_Line;
Put ("Confirmer la modification [O pour oui, autre pour non] : ");
Get (Choix);
Skip_Line;
if Choix = 'o' or Choix = 'O' then
Attribuer_Registre (Etat.Arbre, Etat.Cle, Personne);
Put_Line ("Personne modifiée avec succès.");
else
Put_Line ("Modification annulée.");
end if;
New_Line;
Etat.Menu := Menu_Registre;
end Afficher_Menu_Registre_Modification;
-- Demande une clé pour afficher les relations d'une personne.
procedure Afficher_Menu_Arbre_Selection (Etat : in out T_Etat) is
Cle : Integer;
Correct : Boolean;
begin
Put_Line ("* Arbre généalogique *");
New_Line;
Correct := False;
while not Correct loop
Put_Line
("Entrez la clé de la personne dont vous voulez consulter l'arbre [0 pour retour].");
Choisir_Cle (Cle);
Correct := Cle = 0 or else Existe_Registre (Etat.Arbre, Cle);
if not Correct then
Put_Line ("Clé inconnue.");
New_Line;