Procedure TFormExtremaN.BtnCommencerClick(Sender: TObject); VAR A,Max,Min:REAL; C:variant; Z:string; Begin Max:=STRTOINT(INPUTBOX('Saisie du nombre','Veuillez introduire une valeur','')); Min:=STRTOINT(INPUTBOX('Saisie du nombre','Veuillez introduire une valeur','')); if Min>Max then // sinon begin A := Max Max := Min; //on inverse Min := A; //on inverse end; Repeat C:=STRTOINT(INPUTBOX('Saisie du nombre','Veuillez introduire une valeur','')); Z := C; if uppercase(Z)='FIN' then C:=0 else begin IF (C>Max) then Max:=C IF (C<Min) then Min:=c; end; Until C=0; EditMaxima.Text:=FloatToStr(Max); EditMinima.Text:=FloatToStr(Min) end;
procedure TFormExtremaN.BtnCommencerClick(Sender: TObject); var A,B,C, Max,Min : Real; T : string; Value : Extended; begin ... repeat T := InputBox('Saisie du nombre','Veuillez introduire une valeur',''); if TryStrToFloat(T, Value) then begin C := StrToFloat(T); if (C > Max) then Max := C else if (C < Min) then Min := C; end; until UpperCase(T) = 'FIN'; ... end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question