LOVEGUN

Function Distinct

Oct 19th, 2020 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.56 KB | None | 0 0
  1. Function distinct (t:tab;i:Integer): Boolean;  {i:compteur du tableau/t:tableau qu'on va travailler dessus}
  2. Var
  3.   j: Integer; {j:les valeurs se trouvant dans le tableau avant la valeur i}
  4.   test: Boolean; {test:Condition}
  5. Begin
  6.   test := True;  {test:ici test=true pour éviter de comparer la valeur si i=1 (ma3ana bech nkarnouha hiya wahadha fel tab)}
  7.   j := 1 ;
  8.   While test And (j<i) Do
  9.     Begin
  10.       test := t[i]<>t[j]; {si t[i]=t[j] alors test va recevoir false et la boucle s'arretera}
  11.       j := j+1;
  12.     End;
  13.   distinct := test;  {résultat final}
  14. End;
Add Comment
Please, Sign In to add comment