![]() |
Wie kann ich das rechnen
soll so rechnen (cb_ring1.ItemIndex*10)+cb_ring2.ItemIndex
Delphi-Quellcode:
cb_ring1 sind also die 10ér stellen
daten := floattostr(((strtofloat(cb_ring1.ItemIndex)*10)+
strtofloat(cb_ring2.ItemIndex))); cb_ring2 sind die 1ér klappt aber nicht |
Re: Wie kann ich das rechnen
und was klappt nicht? gibt es nen fehler?
|
Re: Wie kann ich das rechnen
.ItemIndex ist normalerweise in Integer ;-)
|
Re: Wie kann ich das rechnen
Ich weiß zwar nicht was cb_ring1 und cb_ring2 ist, aber ItemIndex sollte im Normalfall ein Integer sein.
Also warum StrToFloat ???
Delphi-Quellcode:
//Edit:
daten := IntToStr((cb_ring1.ItemIndex*10) + cb_ring2.ItemIndex);
Dann recht auch IntToStr! |
Re: Wie kann ich das rechnen
Hallo!
Kann es sein, daß Du hier zwei Comboboxen mit den Ziffern [0..9] gefüllt hast und nun den Wert ermitteln willst, den der Benutzer eingestellt hat? Dann muss das so sein:
Delphi-Quellcode:
hope it helps
daten := (StrToInt (cb_ring1.Items[cb_ring1.ItemIndex])) * 10
+ (StrToInt (cb_ring2.Items[cb_ring2.ItemIndex])); onlinekater |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
klappt einwandfre
daten := IntToStr((cb_ring1.ItemIndex*10) + cb_ring2.ItemIndex);
nächstes problem prozentrechnung
Delphi-Quellcode:
if StrTofloat(wiederstand)<1000 then begin
pnl_result.caption := (floattostr((strtofloat(wiederstand)/ ///wiederstand ist ne variable 1))+' Ohm');// der genaue wert pnl_worstcasemin.caption := (floattostr((strtofloat(wiederstand)/ ???????))+' Ohm');// der minimale wert pnl_worstcasemax.caption := (floattostr((strtofloat(wiederstand)/ ???????))+' Ohm');// der maximale wert end; if rb_4rings.Checked then begin if cb_ring4.ItemIndex = 0 then pnl_Tolerance.Caption:= '10%'; // und hier sind die toleranzen if cb_ring4.ItemIndex = 1 then pnl_Tolerance.Caption:= '5%' ; if cb_ring4.ItemIndex = 2 then pnl_Tolerance.Caption:= '1%' ; if cb_ring4.ItemIndex = 3 then pnl_Tolerance.Caption:= '2%' ; if cb_ring4.ItemIndex = 4 then pnl_Tolerance.Caption:= '0,5%'; if cb_ring4.ItemIndex = 5 then pnl_Tolerance.Caption:= '0,25%'; if cb_ring4.ItemIndex = 6 then pnl_Tolerance.Caption:= '0,1%' ; end; if rb_5rings.Checked then begin if cb_ring55.ItemIndex = 0 then pnl_Tolerance.Caption:= '5%'; if cb_ring55.ItemIndex = 1 then pnl_Tolerance.Caption:= '1%' ; if cb_ring55.ItemIndex = 2 then pnl_Tolerance.Caption:= '2%' ; if cb_ring55.ItemIndex = 3 then pnl_Tolerance.Caption:= '0,5%' ; if cb_ring55.ItemIndex = 4 then pnl_Tolerance.Caption:= '0,25%'; if cb_ring55.ItemIndex = 5 then pnl_Tolerance.Caption:= '0,1%'; end; end; |
Re: Wie kann ich das rechnen
Ich würde den Widerstand in einer (Extended)-variablen zwischenspeichern und dann mit dieser Weiterrechnen.
Die erste Zeile kannst du vereinfachen, indem du den String nimmst und ' Ohm' hinzufügst den eine Zahl durch ein ergibt ja die Zahl ;-) Wie berechnen sich die anderen Werte ( minimal + maximal)? und was daß mit Prozentrechnung zu tun? |
Re: Wie kann ich das rechnen
ich würde dir als erstes emphelen dir mal den styleguide auf
![]()
Delphi-Quellcode:
sieht doch schon mal besser aus, oder?var x: extended; begin if rb_4rings.Checked then begin x := cb_ring4.ItemIndex case x of 0: pnl_Tolerance.Caption:= '10%'; // und hier sind die toleranzen 1: pnl_Tolerance.Caption:= '5%' ; 2: pnl_Tolerance.Caption:= '1%' ; 3: pnl_Tolerance.Caption:= '2%' ; 4: pnl_Tolerance.Caption:= '0,5%'; 5: pnl_Tolerance.Caption:= '0,25%'; 6: pnl_Tolerance.Caption:= '0,1%' ; end; end; end; |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
kann mir das jemand so umstellen das es klappt
tolerance := floattostr((strtofloat((pnl_result.caption)/100)*prozent));
|
Re: Wie kann ich das rechnen
Hi!
Könntest du bitte deinem Thread noch einen aussagekräftigen Titel geben? Darunter kann man sich nur wenig vorstellen! Ciao, Frederic |
Re: Wie kann ich das rechnen
Zitat:
Selbes gilt für prozent. Des Weiteren wäre es auch nicht verkehrt uns mitzuteilen, welche Fehlermeldungen kommen. |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
Sollte gehen wenn Prozent ein Integer- oder Floatwert ist und tolerance ein String ist.
tolerance := floattostr( (strtofloat(pnl_result.caption)/100)*prozent);
Grüße Klaus |
Re: Wie kann ich das rechnen
ich werds nie raffen
Delphi-Quellcode:
widerstand : string;
tolerance: extended; prozent: extended;
Delphi-Quellcode:
und hier die Formel mit dem Problem
tolerance := floattostr( (strtofloat(widerstand)/100)*(prozent));
Delphi-Quellcode:
die klappt einwandfrei
pnl_worstcasemin.caption := (floattostr((strtofloat(widerstand)/
1-(tolerance))+' Ohm'));
Delphi-Quellcode:
pnl_result.caption := (floattostr((strtofloat(widerstand)/
1))+' Ohm'); |
Re: Wie kann ich das rechnen
wenn ich das richrig sehe, hast du die klammern falsch gesetzt...
Delphi-Quellcode:
lässt sich doch viel leichter lesen, oder? :o
//aus
pnl_worstcasemin.caption := (floattostr((strtofloat(widerstand)/1-(tolerance))+' Ohm'[color=#ff0000])[/color]); //wird pnl_worstcasemin.caption := (floattostr((strtofloat(widerstand)/1-(tolerance))[color=#00ff00])[/color]+' Ohm'); //achja, division durch 1 und die stringroutinen... var widerstand:extended; pnl_worstcasemin.caption := floattostr(widerstand-tolerance)+' Ohm'; //edit @mkinzler (nachfolgendes post): hab mich schon gewundert...wegen dem /(1-tolerance), er hat die prozentuale toleranz schon. warum hast du das farbige komplett raus? hätte Eindruck gemacht. Gruß Frank |
Re: Wie kann ich das rechnen
Du scheinst uns nicht zu trauen, da du unsere Ratschläge mit einer Bestimmtheit igonierst.
Man rechnet nicht mit strings.
Delphi-Quellcode:
widerstand : Extended;
Delphi-Quellcode:
tolerance := widerstand/100*prozent;
Delphi-Quellcode:
pnl_worstcasemin.caption := floattostr(widerstand-tolerance)+' Ohm';
Delphi-Quellcode:
pnl_result.caption := floattostr(widerstand)+' Ohm';
|
Re: Wie kann ich das rechnen
Dsa klappt so net immer wenn ich irgendwas verändere klappt was anderes wieder nicht
deswegen mal komplett nich meckern binn noch nicht fertig mit dem optimieren der Normwiderstände
Delphi-Quellcode:
procedure TForm2.btn_executeClick(Sender: TObject);
var wert : string; widerstand : string; tolerance: string; prozent: extended; begin if rb_4rings.Checked then begin ++++++wollte ich umstellen (case) tut dann aber auch dumm wert := floattostr(((cb_ring1.ItemIndex+1)*10) + cb_ring2.ItemIndex); if cb_ring3.ItemIndex = 0 then widerstand := floattostr((strtofloat(wert)/100)); if cb_ring3.ItemIndex = 1 then widerstand := floattostr((strtofloat(wert)/10)); if cb_ring3.ItemIndex = 2 then widerstand := floattostr((strtofloat(wert)*1)); if cb_ring3.ItemIndex = 3 then widerstand := floattostr((strtofloat(wert)*10)); if cb_ring3.ItemIndex = 4 then widerstand := floattostr((strtofloat(wert)*100)); if cb_ring3.ItemIndex = 5 then widerstand := floattostr((strtofloat(wert)*1000)); if cb_ring3.ItemIndex = 6 then widerstand := floattostr((strtofloat(wert)*10000)); if cb_ring3.ItemIndex = 7 then widerstand := floattostr((strtofloat(wert)*100000)); if cb_ring3.ItemIndex = 8 then widerstand := floattostr((strtofloat(wert)*1000000)); if cb_ring3.ItemIndex = 9 then widerstand := floattostr((strtofloat(wert)*10000000)); end; if rb_5rings.Checked then begin wert := floattostr(((cb_ring1.ItemIndex+1)*100) + ((cb_ring2.ItemIndex)*10) + (cb_ring53.ItemIndex)); if cb_ring54.ItemIndex = 0 then widerstand := floattostr((strtofloat(wert)/100)); if cb_ring54.ItemIndex = 1 then widerstand := floattostr((strtofloat(wert)/10)); if cb_ring54.ItemIndex = 2 then widerstand := floattostr((strtofloat(wert)*1)); if cb_ring54.ItemIndex = 3 then widerstand := floattostr((strtofloat(wert)*10)); if cb_ring54.ItemIndex = 4 then widerstand := floattostr((strtofloat(wert)*100)); if cb_ring54.ItemIndex = 5 then widerstand := floattostr((strtofloat(wert)*1000)); if cb_ring54.ItemIndex = 6 then widerstand := floattostr((strtofloat(wert)*10000)); if cb_ring54.ItemIndex = 7 then widerstand := floattostr((strtofloat(wert)*100000)); if cb_ring54.ItemIndex = 8 then widerstand := floattostr((strtofloat(wert)*1000000)); if cb_ring54.ItemIndex = 9 then widerstand := floattostr((strtofloat(wert)*10000000)); end; begin if StrTofloat(widerstand)>=1000000 then begin pnl_result.caption := (floattostr((strtofloat(widerstand)/ 1000000))+' MOhm'); pnl_worstcasemin.caption := '?'; pnl_worstcasemax.caption := '?'; end; if StrTofloat(widerstand)>=1000 then begin if StrTofloat(widerstand)<1000000 then begin pnl_result.caption := (floattostr((strtofloat(widerstand)/ 1000))+' KOhm'); pnl_worstcasemin.caption := '?'; pnl_worstcasemax.caption := '?'; end; end; if StrTofloat(widerstand)<1000 then begin pnl_result.caption := (floattostr((strtofloat(widerstand)/ ++++++das klappt 1))+' Ohm'); pnl_worstcasemin.caption := (floattostr((strtofloat(widerstand)/ ++++++und hier das problem 1+(tolerance))+' Ohm')); pnl_worstcasemax.caption := (floattostr((strtofloat(widerstand)/ ++++++und hier das problem 1+(tolerance))+' Ohm')); end; tolerance := floattostr( (strtofloat(widerstand)/100)*(prozent)); if rb_5rings.Checked then begin if cb_ring55.ItemIndex = 0 then begin ++++++wollte ich umstellen (case) tut dann aber auch dumm 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; procedure TForm2.btn_execute_preresistClick(Sender: TObject); begin +++hier bin ich noch nicht fertig mit umbauen case trunc(resistor) of +++seit ich das so hab bleibt das panel beim ersten 25000..33001:pnl_normresistor.Caption := '27 KOhm'; +++drücken des Buttons leer erst beim 2. betätigen 16500..22001:pnl_normresistor.Caption := '22 KOhm'; +++erfolgt die ausgabe 13500..16499:pnl_normresistor.Caption := '18 KOhm'; 12000..13499:pnl_normresistor.Caption := '15 KOhm'; 10000..11999:pnl_normresistor.Caption := '12 KOhm'; 8200..9999:pnl_normresistor.Caption := '10 KOhm'; 6800..8199:pnl_normresistor.Caption := '8,2 KOhm'; 5600..6799:pnl_normresistor.Caption := '6,8 KOhm'; 4700..5599:pnl_normresistor.Caption := '5,6 KOhm'; 3900..4699:pnl_normresistor.Caption := '4,7 KOhm'; 3300..3899:pnl_normresistor.Caption := '3,9 KOhm'; 2200..3299:pnl_normresistor.Caption := '3,3 KOhm'; end; {else case trunc(resistor*10) of 1..12://ist (0.1)..(1.2) alles mit kommastellen hier rein end; } begin if (Resistor)>2200 then begin if (Resistor)<3301 then pnl_normresistor.Caption := (floattostr(2.2)+' KOhm') end; end; begin if (Resistor)>1625 then begin if (Resistor)<2201 then pnl_normresistor.Caption := (floattostr(1.8)+' KOhm') end; end; begin if (Resistor)>1500 then begin if (Resistor)<1626 then pnl_normresistor.Caption := (floattostr(1.5)+' KOhm') end; end; usw...... end; |
Re: Wie kann ich das rechnen
Zitat:
.oO(ist denn das so schwer zu verstehen?) :gruebel: :wall: sorry admins, war jetzt mal nötig... @gehstock: bring erstmal das in ordnung...(und danach die Einrückungen, damit dein Code lesbar wird) Gruß Frank |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
eine Rechnung durch 100 entspricht einer Multiplikation mit 0.01 // ItemIndex = 0
if rb_4rings.Checked then
begin ++++++wollte ich umstellen (case) tut dann aber auch dumm wert := floattostr(((cb_ring1.ItemIndex+1)*10) + cb_ring2.ItemIndex); if cb_ring3.ItemIndex = 0 then widerstand := floattostr((strtofloat(wert)/100)); if cb_ring3.ItemIndex = 1 then widerstand := floattostr((strtofloat(wert)/10)); if cb_ring3.ItemIndex = 2 then widerstand := floattostr((strtofloat(wert)*1)); if cb_ring3.ItemIndex = 3 then widerstand := floattostr((strtofloat(wert)*10)); if cb_ring3.ItemIndex = 4 then widerstand := floattostr((strtofloat(wert)*100)); if cb_ring3.ItemIndex = 5 then widerstand := floattostr((strtofloat(wert)*1000)); if cb_ring3.ItemIndex = 6 then widerstand := floattostr((strtofloat(wert)*10000)); if cb_ring3.ItemIndex = 7 then widerstand := floattostr((strtofloat(wert)*100000)); if cb_ring3.ItemIndex = 8 then widerstand := floattostr((strtofloat(wert)*1000000)); if cb_ring3.ItemIndex = 9 then widerstand := floattostr((strtofloat(wert)*10000000)); end; eine Rechnung durch 10 entspricht einer Multiplikation mit (0.01 *10^1) -> 0.1 // ItemIndex = 1 eine Rechnung * 1 entspricht einer Multiplikation mit (0.01 *10^2) -> 1 // ItemIndex = 2 -> wenn dann wert ein Typ float ist und widerstand auch
Delphi-Quellcode:
Ist etwas kürzer und hoffentlich auch richtig.
if rb_4rings.checked then
begin wert := ((cb_ring1.ItemIndex+1)*10) + cb_ring2.ItemIndex; widerstand := wert * 0.01 * power(10,cb_rings3.ItemIndex); end; Habe es nicht ausprobiert. Grüße Klaus |
Re: Wie kann ich das rechnen
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; |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
Du hast ja anscheinend eine Klammermanie, soviele unnötige Klammern, da
if (widerstand)<1000 then
begin pnl_result.caption := floattostr(widerstand)+' Ohm'; pnl_worstcasemin.caption := floattostr(widerstand-tolerance)+' Ohm'; +++++da ist der Fehler pnl_worstcasemax.caption := floattostr(widerstand +tolerance)+' Ohm'; ?????falsche klammer end; kommt man schon durcheinander. Grüße Klaus |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
if rb_4rings.Checked then
begin case cb_ring4.ItemIndex of 0:prozent:=10; 1:prozent:=5; 2:prozent:=1; 3:prozent:=2; 4:prozent:=0.5; 5:prozent:=0.25; 6:prozent:=0.1; end; pnl_Tolerance.Caption:= format('%.2f',[prozent]); end; Zitat:
|
Re: Wie kann ich das rechnen
Liste der Anhänge anzeigen (Anzahl: 1)
Bokomme aber fehler bei
Delphi-Quellcode:
pnl_worstcasemin.caption := floattostr(widerstand-tolerance)+' Ohm';
pnl_worstcasemax.caption := floattostr(widerstand+tolerance)+' Ohm'; invalid floating point operation |
Re: Wie kann ich das rechnen
Du solltest den Wert für tolerance berechnen, bevor du ihn verwendest:
Delphi-Quellcode:
Gruß Hawkeye
if (widerstand)<1000 then begin
pnl_result.caption := (floattostr((widerstand)/1))+' Ohm'; pnl_worstcasemin.caption := (floattostr((widerstand)/1-(tolerance)))+' Ohm'; // <<-- verwendet pnl_worstcasemax.caption := (floattostr((widerstand)/1+(tolerance)))+' Ohm'; // <<-- verwendet end; tolerance := (widerstand)/100*(prozent); // <<----- zu spät berechnet! |
Re: Wie kann ich das rechnen
Nee das ist es nicht selbes ergebnis
Delphi-Quellcode:
und wi bekomme ich an der stelle hin das er nicht 10,00 % anzeigt sondern nur 10 %
if rb_4rings.Checked then
begin case cb_ring4.ItemIndex of 0:prozent:=10; 1:prozent:=5; 2:prozent:=1; 3:prozent:=2; 4:prozent:=0.5; 5:prozent:=0.25; 6:prozent:=0.1; end; pnl_Tolerance.Caption:= format('%.2f',[prozent])+' %'; end; |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
Versuche es einmal damit, ein Blick in die Hilfe würde auch nicht schaden.
pnl_Tolerance.Caption:= format('%g',[prozent])+' %';
Grüße Klaus |
Re: Wie kann ich das rechnen
Zitat:
![]()
Delphi-Quellcode:
Jürgen
pnl_Tolerance.Caption:= format('%f %%',[prozent]);
|
Re: Wie kann ich das rechnen
Zitat:
ich denke, *DU* willst programmieren... Gruß Frank |
Re: Wie kann ich das rechnen
ganz ohne Tolerance hab ich doch auch schon versucht
Delphi-Quellcode:
Ergebnis bleibt das selbe
pnl_worstcasemin.caption := (floattostr((widerstand)/1-(widerstand)/100*(prozent)))+' Ohm';
pnl_worstcasemax.caption := (floattostr((widerstand)/1+(widerstand)/100*(prozent)))+' Ohm'; |
Re: Wie kann ich das rechnen
ein Hoch auf die Mathematik und die Möglichkeit Formeln umzustellen:
Delphi-Quellcode:
Grüße
pnl_worstcasemin.caption := floattostr(widerstand*(1-prozent/100))+' Ohm';
pnl_worstcasemin.caption := floattostr(widerstand*(1+prozent/100))+' Ohm'; Klaus |
Re: Wie kann ich das rechnen
Delphi-Quellcode:
also bei mir haut das hin...du musst ggf. prüfen, ob deine Berechnungen vorher i.O. sind
procedure TForm1.Button1Click(Sender: TObject);
var widerstand,tolerance:extended; const prozent=2.5; begin widerstand:=StrToFloat(Edit1.text); tolerance:=widerstand/100*prozent; edit2.text:=FloatToStr(Tolerance); edit3.text:=floattostr(widerstand-tolerance)+' Ohm'; edit4.text:=floattostr(widerstand+tolerance)+' Ohm'; end; //edit: warum denn die 1? Gruß Frank |
Re: Wie kann ich das rechnen
Liste der Anhänge anzeigen (Anzahl: 1)
OkoOk
war doppeltgemoppelt :mrgreen: hat denn aber keiner ne idee :gruebel: was den Fehler angeht Fehler in den Variablen???
Delphi-Quellcode:
wert : extended;
widerstand : extended; prozent: extended; Zitat:
|
Re: Wie kann ich das rechnen
Zitat:
Gruß Hawkeye |
Re: Wie kann ich das rechnen
Zitat:
|
Re: Wie kann ich das rechnen
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz