passage d'un tableau structuré en parametre
bonjour,
j'ai un petit souci, je suis en train de programmer un dictionnaire dans lequel on pourra ajouter un mot en enlever le modifier...
j'utilise donc pour chaque type d'opérations des procedures.
et la je :aie: sur le passage de parametre de mon tableau
Code:
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
|
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
jpeg, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
ajoutnom: TButton;
recherchetype: TButton;
modifdef: TButton;
modifortho: TButton;
supprmot: TButton;
recherchenom: TButton;
Label1: TLabel;
Image1: TImage;
Image2: TImage;
nbmot: TEdit;
Nbmot2: TLabel;
nbmax: TEdit;
mot: TEdit;
Label2: TLabel;
procedure ajoutnomClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
type TTypeDico = record // structure typedico
nom:string;
typnom:string;
def:string;
end;
TMot = array[1..100] of TTypeDico;
var nom,typnom,def: TTypeDico;
implementation
{$R *.DFM}
procedure recherche (mot,nbmot:string;ind:integer;trouve:boolean;TMot :array of TTypedico);
// recherche un mot dans le dico
var
arret:boolean;
begin
trouve:= false;
arret:= false;
ind:=1;
while (not arret) and (ind < strtoint(nbmot)) do
begin
if TMot[ind].nom >= mot
then begin
arret:= true;
if TMot[ind].nom= mot
then trouve:= true
end
else ind:=ind+1;
end;
end;
procedure TForm1.ajoutnomClick(Sender: TObject);
var
trouve:boolean;
ind:integer;
begin
ajoutnom.visible:=false;
recherchetype.visible:=false;
modifdef.visible:=false;
modifortho.visible:=false;
supprmot.visible:=false;
recherchenom.visible:=false;
if nbmot=nbmax
then showmessage('tableau plein')
else begin
recherche(mot.text,nbmot.text,ind,trouve,TMot[i]);
if trouve=true
then showmessage ('mot existe déjà')
else begin
for i:=nbmot to ind do
begin
TMot[i+1]:= TMot[i];
end;
end;
end. |
merci d'avance pour vos réponses