Einzelnen Beitrag anzeigen

Gehstock

Registriert seit: 28. Jan 2006
Ort: Görlitz / Sachsen
489 Beiträge
 
Delphi 2007 Professional
 
#19

Re: Wie kann ich das rechnen

  Alt 19. Aug 2006, 13:06
Ist es Danke
ging ja alles von ganz alleine auser die toleranz

Delphi-Quellcode:
procedure TForm2.btn_executeClick(Sender: TObject);
var
wert : extended;
widerstand : extended;
tolerance: extended;
prozent: extended;

begin
if rb_4rings.Checked then begin
wert := ((cb_ring1.ItemIndex+1)*10) + cb_ring2.ItemIndex;
widerstand := wert * 0.01 * power(10,cb_ring3.ItemIndex);
 end;

if rb_5rings.Checked then begin
wert := ((cb_ring1.ItemIndex+1)*100) +((cb_ring1.ItemIndex+1)*10) + cb_ring2.ItemIndex;
widerstand := wert * 0.01 * power(10,cb_ring54.ItemIndex);
 end;
begin
if (widerstand)>=1000000 then begin
pnl_result.caption := (floattostr((widerstand)/1000000))+' MOhm';
pnl_worstcasemin.caption := '?';
pnl_worstcasemax.caption := '?';
 end;
if (widerstand)>=1000 then begin
 if (widerstand)<1000000 then begin
pnl_result.caption := (floattostr((widerstand)/1000))+' KOhm';
pnl_worstcasemin.caption := '?';
pnl_worstcasemax.caption := '?';
 end;
  end;
if (widerstand)<1000 then begin
pnl_result.caption := (floattostr((widerstand)/1))+' Ohm';
pnl_worstcasemin.caption := (floattostr((widerstand)/1-(tolerance)))+' Ohm'; +++++da ist der Fehler
pnl_worstcasemax.caption := (floattostr((widerstand)/1+(tolerance)))+' Ohm'; ?????falsche klammer
 end;
tolerance := (widerstand)/100*(prozent);
if rb_5rings.Checked then begin

if cb_ring55.ItemIndex = 0 then begin
pnl_Tolerance.Caption:= '5%';
prozent:=(5);
 end;
if cb_ring55.ItemIndex = 1 then begin
pnl_Tolerance.Caption:= '1%';
prozent:=(1);
 end;
if cb_ring55.ItemIndex = 2 then begin
pnl_Tolerance.Caption:= '2%';
prozent:=(2);
 end;
if cb_ring55.ItemIndex = 3 then begin
pnl_Tolerance.Caption:= '0,5%';
prozent:=(0.5);
 end;
if cb_ring55.ItemIndex = 4 then begin
pnl_Tolerance.Caption:= '0,25%';
prozent:=(0.25);
 end;
if cb_ring55.ItemIndex = 5 then begin
pnl_Tolerance.Caption:= '0,1%';
prozent:=(0.1);
 end;
 end;

if rb_4rings.Checked then begin

if cb_ring4.ItemIndex = 0 then begin
pnl_Tolerance.Caption:= '10%';
prozent:=(10);
 end;
if cb_ring4.ItemIndex = 1 then begin
pnl_Tolerance.Caption:= '5%';
prozent:=(5);
 end;
if cb_ring4.ItemIndex = 2 then begin
pnl_Tolerance.Caption:= '1%';
prozent:=(1);
 end;
if cb_ring4.ItemIndex = 3 then begin
pnl_Tolerance.Caption:= '2%';
prozent:=(2);
 end;
if cb_ring4.ItemIndex = 4 then begin
pnl_Tolerance.Caption:= '0,5%';
prozent:=(0.5);
 end;
if cb_ring4.ItemIndex = 5 then begin
pnl_Tolerance.Caption:= '0,25%';
prozent:=(0.25);
 end;
if cb_ring4.ItemIndex = 6 then begin
pnl_Tolerance.Caption:= '0,1%';
prozent:=(0.1);
end;
 end;
  end;
   end;
Marcel
  Mit Zitat antworten Zitat