Delphi BX Bedienungsanleitung Seite 12

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 46
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 11
page 59 de 93
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Buttons;
type
Tformulaire = class(TForm)
gbCoeff: TGroupBox;
lblA: TLabel;
lblB: TLabel;
lblC: TLabel;
edtA: TEdit;
edtB: TEdit;
edtC: TEdit;
btnCalcul: TButton;
gbRes: TGroupBox;
lblTexte: TLabel;
lblX1: TLabel;
lblX2: TLabel;
btnExit: TButton;
procedure btnCalculClick(Sender: TObject);
procedure btnExitClick(Sender: TObject);
private
{ Private-Declarations}
public
{ Public-Declarations }
end; //Tformulaire
var formulaire: Tformulaire;
implementation
{$R *.DFM}
procedure Tformulaire.btnCalculClick(Sender: TObject);
var a,b,c,disc : real;
begin
a:=StrtoFloat(edta.Text);
b:=StrtoFloat(edtb.Text);
c:=StrtoFloat(edtc.Text);
disc:=b*b-4*a*c;
if disc < 0 then
begin
lblTexte.Caption:='
Il n''y a pas de solution réelle !
';
lblX1.Caption:='';
lblX2.Caption:='';
end
else if round(disc*1000000) = 0 then
//un nombre reel n’est jamais 0
begin
lblTexte.Caption:='
Il existe une solution réelle !
';
lblX1.Caption:='x = ' + FloattoStr(-b/(2*a));
lblX2.Caption:='';
end
else if disc > 0 then
begin
lblTexte.Caption:='
Il y a deux solutions réelles différentes !
';
lblX1.Caption:='
x1 =
' + FloattoStr((-b-sqrt(disc))/(2*a));
Seitenansicht 11
1 2 ... 7 8 9 10 11 12 13 14 15 16 17 ... 45 46

Kommentare zu diesen Handbüchern

Keine Kommentare