Thema: Delphi Punkt vor Strich?

Einzelnen Beitrag anzeigen

Benutzerbild von Die Muhkuh
Die Muhkuh

Registriert seit: 21. Aug 2003
7.332 Beiträge
 
Delphi 2009 Professional
 
#5

Re: Punkt vor Strich?

  Alt 27. Aug 2003, 19:52
Also hier ist der !!!gesamte!!! Code:
Delphi-Quellcode:
var
  Rechnen: TRechnen;
  a, b, c, d, e, f, g, z1, z2, z3, er : Extended;

implementation

uses Unit1, Unit2, Unit4, Unit5, Unit6, Unit7, shellapi;

{$R *.DFM}

procedure TRechnen.Button5Click(Sender: TObject);
begin
  
  if Combobox5.itemindex = 0 then
    begin
      a := strtofloat (Edit1.text);
      b := strtofloat (Edit2.text);

        case Combobox1.itemindex of
          0: er := a + b;
          1: er := a - b;
          2: er := a * b;
          3: er := a / b;
        end;
      Panel1.caption := floattostr (er);
    end;

  if Combobox5.itemindex = 1 then
    begin
      a := strtofloat (Edit1.text);
      b := strtofloat (edit2.text);
      c := strtofloat (Edit3.text);

        case Combobox1.ItemIndex of
          0: z1 := a + b;
          1: z1 := a - b;
          2: z1 := a * b;
          3: z1 := a / b;
        end;

        case combobox2.itemindex of
          0: er := z1 + c;
          1: er := z1 - c;
          2: er := z1 * c;
          3: er := z1 / c;
        end;
      Panel1.caption := floattostr (er);
     end;

    if Combobox5.itemindex = 2 then
      begin
        a := strtofloat (Edit1.text);
        b := strtofloat (Edit2.text);
        c := strtofloat (Edit3.text);
        d := strtofloat (Edit4.text);

          case Combobox1.itemindex of
            0: z1 := a + b;
            1: z1 := a - b;
            2: z1 := a * b;
            3: z1 := a / b;
          end;

          case combobox2.itemindex of
            0: z2 := z1 + c;
            1: z2 := z1 - c;
            2: z2 := z1 * c;
            3: z2 := z1 / c;
          end;

          case Combobox3.ItemIndex of
            0 : er := z2 + d;
            1 : er := z2 - d;
            2 : er := z2 * d;
            3 : er := z2 / d;
          end;
        Panel1.caption := floattostr (er);
      end;

    if Combobox5.itemindex = 3 then
      begin
         a := strtofloat (Edit1.text);
         b := strtofloat (Edit2.text);
         c := strtofloat (Edit3.text);
         d := strtofloat (Edit4.text);
         e := strtofloat (Edit5.text);

           case Combobox1.itemindex of
             0: z1 := a + b;
             1: z1 := a - b;
             2: z1 := a * b;
             3: z1 := a / b;
           end;

           case combobox2.itemindex of
             0: z2 := z1 + c;
             1: z2 := z1 - c;
             2: z2 := z1 * c;
             3: z2 := z1 / c;
           end;

           case Combobox3.ItemIndex of
             0 : z3 := z2 + d;
             1 : z3 := z2 - d;
             2 : z3 := z2 * d;
             3 : z3 := z2 / d;
           end;

           case Combobox3.ItemIndex of
             0 : er := z3 + d;
             1 : er := z3 - d;
             2 : er := z3 * d;
             3 : er := z3 / d;
           end;
         Panel1.caption := floattostr (er);
      end;

    if Combobox5.itemindex = 4 then
      begin
        f := strtofloat (Edit1.text);

        er := Sqr(f);
        Panel1.caption := floattostr (er);
      end;
    if Combobox5.ItemIndex = 5 then
      begin
        g := strtofloat (Edit1.text);

        er:= Sqrt(g) ;
        Panel1.caption := floattostr (er);
      end;
end;

procedure TRechnen.ComboBox5Change(Sender: TObject);
begin
  if Combobox5.ItemIndex = 0 then
    begin
      Edit1.visible := true;
      Edit2.visible := true;
      Edit3.visible := false;
      Edit4.visible := false;
      Edit5.visible := false;
      Edit1.text := '';
      Edit2.text := '';
      Edit3.text := '';
      Edit4.text := '';
      Edit5.text := '';

      Combobox1.visible := true;
      Combobox2.visible := false;
      combobox3.visible := false;
      Combobox4.visible := false;
      Combobox1.Text := '';
      Combobox2.Text := '';
      Combobox3.Text := '';
      Combobox4.Text := '';
      Combobox5.Text := '';

      Panel1.Caption := '';
     end;

  if Combobox5.itemindex = 1 then
    begin
      Edit1.visible := true;
      Edit2.visible := true;
      Edit3.visible := true;
      Edit4.visible := false;
      Edit5.visible := false;
      Edit1.text := '';
      Edit2.text := '';
      Edit3.text := '';
      Edit4.text := '';
      Edit5.text := '';

      Combobox1.visible := true;
      Combobox2.visible := true;
      combobox3.visible := false;
      Combobox4.visible := false;
      Combobox1.Text := '';
      Combobox2.Text := '';
      Combobox3.Text := '';
      Combobox4.Text := '';
      Combobox5.Text := '';

      Panel1.Caption := '';
    end;

  if Combobox5.itemindex = 2 then
    begin
      Edit1.visible := true;
      Edit2.visible := true;
      Edit3.visible := true;
      Edit4.visible := true;
      Edit5.visible := false;
      Edit1.text := '';
      Edit2.text := '';
      Edit3.text := '';
      Edit4.text := '';
      Edit5.text := '';

      Combobox1.visible := true;
      Combobox2.visible := true;
      combobox3.visible := true;
      Combobox4.visible := false;
      Combobox1.Text := '';
      Combobox2.Text := '';
      Combobox3.Text := '';
      Combobox4.Text := '';
      Combobox5.Text := '';

      Panel1.Caption := '';
    end;

   if Combobox5.itemindex = 3 then
     begin
       Edit1.visible := true;
       Edit2.visible := true;
       Edit3.visible := true;
       Edit4.visible := true;
       Edit5.visible := true;
       Edit1.text := '';
       Edit2.text := '';
       Edit3.text := '';
       Edit4.text := '';
       Edit5.text := '';

       Combobox1.visible := true;
       Combobox2.visible := true;
       combobox3.visible := true;
       Combobox4.visible := true;
       Combobox1.Text := '';
       Combobox2.Text := '';
       Combobox3.Text := '';
       Combobox4.Text := '';
       Combobox5.Text := '';

       Panel1.Caption := '';
     end;

   if Combobox5.itemindex = 4 then
     begin
       Edit1.visible := true;
       Edit2.visible := false;
       Edit3.visible := false;
       Edit4.visible := false;
       Edit5.visible := false;
       Edit1.text := '';
       Edit2.text := '';
       Edit3.text := '';
       Edit4.text := '';
       Edit5.text := '';

       Combobox1.visible := false;
       Combobox2.visible := false;
       combobox3.visible := false;
       Combobox4.visible := false;
       Combobox1.Text := '';
       Combobox2.Text := '';
       Combobox3.Text := '';
       Combobox4.Text := '';
       Combobox5.Text := '';

       Panel1.Caption := '';
     end;

   if Combobox5.itemindex = 5 then
     begin
       Edit1.visible := true;
       Edit2.visible := false;
       Edit3.visible := false;
       Edit4.visible := false;
       Edit5.visible := false;
       Edit1.text := '';
       Edit2.text := '';
       Edit3.text := '';
       Edit4.text := '';
       Edit5.text := '';

       Combobox1.visible := false;
       Combobox2.visible := false;
       combobox3.visible := false;
       Combobox4.visible := false;
       Combobox1.Text := '';
       Combobox2.Text := '';
       Combobox3.Text := '';
       Combobox4.Text := '';
       Combobox5.Text := '';

       Panel1.Caption := '';
     end;
end;
Das ist der doch nicht ganz gesamte Code(Der gesamte ist 850 Zeilen lang!) Wahrscheinlich hätte man einiges Verbessern können so weit bin ich nocht net!
Manuel
  Mit Zitat antworten Zitat