Thema: Delphi Taschenrechner Ausgabe

Einzelnen Beitrag anzeigen

safak67

Registriert seit: 22. Mär 2009
87 Beiträge
 
#1

Taschenrechner Ausgabe

  Alt 5. Jun 2009, 07:31
Hallo erstmal,

ich habe Probleme mit der Ausgabe von dem Taschenrechner. Ich kriege iwi keine Ausgabe. Vllt kann einer helfen

Delphi-Quellcode:
function TFormTR.BerechneTerm(Formular: string): Double;

  var Seg1,Seg2 : double;
      index : integer;
      Op : string;
begin
  Formular := LabelAnzeige.Caption;
  for index := 0 to 3 do
  begin
    case index of
    0: Op := '*';
    1: Op := '/';
    2: Op := '+';
    3: Op := '-';
    end;
    if pos(Op,Formular) > 1 then
    begin
      Seg1 := BerechneTerm(copy(Formular,1,pos(Op,Formular) - 1));
      Seg2 := BerechneTerm(copy(Formular,pos(Op,Formular) + 1,length(Formular)));
      case index of
        0: Result := Seg1 + Seg2;
        1: Result := Seg1 - Seg2;
        2: Result := Seg1 * Seg2;
        3: Result := Seg1 / Seg2;
     end;
  end;
end;
   Result := StrToFloat(FloatToStr(BerechneTerm(LabelAnzeige.Caption)));

end;