Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar Mot_Cache: string; // Le vrai mot caché à trouver procedure TForm1.FormCreate(Sender: TObject); var a : byte; begin Mot_Cache := 'ABCDEF'; Label1.Caption := ''; // On vide le label qui affiche les '?' for a := 1 to Length(Mot_Cache) do Label1.Caption := Label1.Caption + '?'; // On remplit le label de a '?' // correspondant au nombre de lettres de Mot_Cache end; procedure TForm1.Button1Click(Sender: TObject); var a : Byte; Mot_Apparent, LettreTapee, txtfinal : string; begin LettreTapee := Edit1.Text; // La lettre tapée est cosidérée comme le caractère étant dans Edit1 actuellement txtfinal := ''; // Texte qui sera assigné au label affichant le mot Mot_Apparent := Label1.Caption; // Le mot apparent dans le label1 est stocké dans Mot_Apparent for a := 1 to Length(Mot_Cache) do begin if LettreTapee = Mot_Cache[a] then // Si la lettre est dans le mot caché txtfinal := txtfinal +LettreTapee // Alors on ajoute cette lettre à la lettre finale else txtfinal := txtfinal + Mot_Apparent[a]; // Ou alors on laisse ce qu'il ya avait avant dans le mot end; Label1.Caption := txtfinal; //On actualise le Label1 end;