1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
| (*-----------------------------------------------MODIFICATION D'UN CONTACT---------------------------------------------*)
(*Nom*)
Function Menu_changing_1(Var t: array of personne; Var qte: Byte):integer;
Var i,j: byte; info: personne;
Begin
Write (' Nom: '); ReadLn (info.nom);
i:=0;
While (info.nom+info.prenom>t[i].nom+t[i].prenom) AND (i<qte) do i:=i+1;
j:=qte;
While (j>i) do
Begin
t[j]:=t[j-1];
j:=j-1;
End;
t[i].nom:=info.nom;
End;
(*Prénom*)
Function Menu_changing_2(Var t: array of personne; Var qte: Byte):integer;
Var i,j: byte; info: personne;
Begin
Write (' Prenom: '); ReadLn (info.prenom);
i:=0;
While (info.nom+info.prenom>t[i].nom+t[i].prenom) AND (i<qte) do i:=i+1;
j:=qte;
While (j>i) do
Begin
t[j]:=t[j-1];
j:=j-1;
End;
t[i].prenom:=info.prenom;
End;
(*rue*)
Function Menu_changing_3(Var t: array of personne; Var qte: Byte):integer;
Var i,j: byte; info: personne;
Begin
Write (' Rue: '); ReadLn (info.rue);
t[i].rue:=info.rue;
End;
(*numero*)
Function Menu_changing_4(Var t: array of personne; Var qte: Byte):integer;
Var i,j: byte; info: personne;
Begin
Write (' Numero: '); ReadLn (info.numero);
t[i].numero:=info.numero;
End;
(*code postal*)
Function Menu_changing_5(Var t: array of personne; Var qte: Byte):integer;
Var i,j: byte; info: personne;
Begin
Write (' Code postal: '); ReadLn (info.cp);
t[i].cp:=info.cp;
End;
(*localité*)
Function Menu_changing_6(Var t: array of personne; Var qte: Byte):integer;
Var i,j: byte; info: personne;
Begin
Write (' Localite: '); ReadLn (info.localite);
t[i].localite:=info.localite;
End;
(*Menu modification*)
Function Menu_changing (Var t: array of personne; qte: Byte):integer;
Var i, j, choix: byte; info: personne;
Begin
choix:=1;
gotoxy(35,1); WriteLn ('____________________');
gotoxy(33,4); WriteLn ('Modification d''un contact');
gotoxy(35,6); WriteLn ('____________________');
WriteLn; WriteLn;
If (qte>0) then
Begin
i:=0; choix:=1;
Write (' Nom: '); ReadLn (info.nom);
Write (' Prenom: '); ReadLn (info.prenom);
WriteLn;
clrscr;
While (info.nom+info.prenom<>t[i].nom+t[i].prenom) AND (i<qte) do i:=i+1;
If (info.nom+info.prenom=t[i].nom+t[i].prenom) AND (i<qte) then
Begin
While (choix<>0) do
Begin
gotoxy(35,1); WriteLn ('____________________');
gotoxy(33,4); WriteLn ('Modification d''un contact');
gotoxy(35,6); WriteLn ('____________________');
WriteLn; WriteLn;
WriteLn(' ',t[i].nom,' ',t[i].prenom,', rue ',t[i].rue,' ',t[i].numero,', ',t[i].cp,' ',t[i].localite,'');
WriteLn;
WriteLn (' Modification');
WriteLn (' ------------');
WriteLn;
WriteLn (' 1) Nom');
WriteLn (' 2) Prenom');
WriteLn (' 3) Rue');
WriteLn (' 4) Numero');
WriteLn (' 5) Code postal');
WriteLn (' 6) Localite');
WriteLn (' 0) Retour');
WriteLn;
Write (' Que voulez vous faire? '); ReadLn (choix);
clrscr;
gotoxy(35,1); WriteLn ('____________________');
gotoxy(33,4); WriteLn ('Modification d''un contact');
gotoxy(35,6); WriteLn ('____________________');
WriteLn; WriteLn;
Case choix of
1: Menu_changing_1(t,qte);
2: Menu_changing_2(t,qte);
3: Menu_changing_3(t,qte);
4: Menu_changing_4(t,qte);
5: Menu_changing_5(t,qte);
6: Menu_changing_6(t,qte);
Else If (choix<>0) then
Begin
clrscr;
gotoxy(35,1); WriteLn ('____________________');
gotoxy(42,4); WriteLn ('Erreur ');
gotoxy(35,6); WriteLn ('____________________');
WriteLn; WriteLn;
WriteLn (' Entrez un numero valide');
WriteLn;
WriteLn (' Pressez ENTER pour revenir au menu'); ReadLn;
clrscr;
End;
End;
End;
End
Else
Begin
gotoxy(35,1); WriteLn ('____________________');
gotoxy(33,4); WriteLn ('Modification d''un contact');
gotoxy(35,6); WriteLn ('____________________');
WriteLn; WriteLn;
WriteLn (' Ce contact n''existe pas');
WriteLn;
WriteLn (' Pressez ENTER pour revenir au menu principal'); ReadLn;
clrscr;
End;
End
Else
Begin
WriteLn (' La liste de contact est vide');
WriteLn;
WriteLn (' Pressez ENTER pour revenir au menu principal'); ReadLn;
clrscr;
End;
End; |
Partager