Delphi-Quellcode:
procedure TForm2.btn_execute_preresistClick(Sender: TObject);
var
u,uf,if_,uv,rv, Result: Real;
ResultI: Integer;
eh:String;
begin
U := StrToFloat(edit_UV.text);
UF:= StrToFloat(edit_UD.text);
IF_:=StrToFloat(edit_ID.text);
begin
UV := U - UF;
RV := UV / IF_;
RV := RV * 1000;
EH := 'Ohm';
Result := RV;
if RV >= 1000 then begin Result := RV / 1000; EH := 'kOhm'; end;
if RV >= 1000000 then begin Result := RV / 1000000; EH := 'MOhm'; end;
if RV >= 1000000000 then begin Result := RV / 1000000; EH := 'GOhm'; end;
begin
pnl_calculated_resistor.caption :=IntToStr(resulti)+EH
end;
end;
end;
so jetzt ergebnis immer 4392024 ohm