Autor Beitrag
kiwicht
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Do 20.03.03 11:39 
...hiho

hab 3 Variablen, und möchte rausbekommen, welche am kleinsten ist.

Gibt es dafür irgendeine Funktion, oder muss ich mir das selber zusammenbauen, so nach dem Motto
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
if a < b then begin
 if a < c then klein := 'a' else
 if c < a then klein := 'c' end else
if b < a then begin
 if b < c then klein := 'b' else
 if c < b then klein := 'c' end else
... usw.....


vielen Dank schon ma im Vorraus....
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 20.03.03 11:41 
ausblenden Quelltext
1:
2:
klein := min(a,b);
klein := min(klein,c);

ungetestet, direkt ins forum geklimpert.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 20.03.03 11:52 
Oder:klein:=min(min(a,b),c);
Du musst allerdings math einbinden!
Oder du schreibst sie selber:
ausblenden Quelltext
1:
2:
3:
4:
function Min(a,b:integer):integer;
begin
 if a<b then Result:=a else Result:=b;
end;


maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Do 20.03.03 11:53 
jupp, danke für die schnell antwort - wird implementiert ... :D ...

und sieht am Ende dann übrigens so aus.. schrecklich :oops:

ausblenden Quelltext
1:
edit1.Text := IntToStr(min(min(StrToInt(jum_stueck1.Text), StrToInt(jum_stueck2.Text)), StrToInt(jum_stueck3.Text)));					


mfg
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Do 20.03.03 13:10 
Hallo,

es gibt auch die Fuktionen MinIntValue und MinValue.

ausblenden Quelltext
1:
klein:=MinIntValue([101, 250, 68]);					


Die o.g. Funktionen sind ebenfalls in der Unit Math implementiert.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Do 20.03.03 13:44 
danke smiegel, damit sieht die Formel dann doch noch n bissel ordentlicher aus :D