Autor Beitrag
EOS
Hält's aus hier
Beiträge: 3

Win XpHome

BeitragVerfasst: Di 29.11.05 08:51 
Moin Schnucken,
ich hab grad das hier gmacht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.Button1Click(Sender: TObject);
var i,n:integer;
var f:extended;
begin

n:=strtoint(edit1.Text);
f:=1;
For i:=1 To n Do f:=f*i;
edit2.text:=floattostr(f);
                                 
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Form1.Close;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
edit1.Clear;
end;

end.


sagt ma was dazu.
mfg #eos

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt.

_________________
Contemplation: If today was perfect, there is no need for tomorrow.
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Di 29.11.05 08:55 
Was soll man jetzt dazu sagen? Hast du irgendein Problem mit dem Code?

MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 29.11.05 08:55 
Geiler Source .. Wo haste den geklaut :P :mrgreen:

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 29.11.05 08:56 
Sieht auf Anhieb so aus, als würdest du die Fakultät berechnen. Mehr fällt mir dazu nicht ein.

_________________
We are, we were and will not be.
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Di 29.11.05 12:19 
Haste fein gemacht, EOS - Lob! </Ironie>

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Di 29.11.05 12:21 
aber mit rekursion wäre es noch geiler...

_________________
"Kein dummes Gerede. Kein Rumrätseln. Denkt an nichts anderes mehr, nur noch an das, was vor euch liegt. Das ist die wahre Herausforderung. Ihr müßt euch vor euch selbst schützen, Leute." (Rennes in "Cube")
Beiträge: >700
matze.de
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 576

Win95, Win98 SE, WinXp Prof SP2
D7P, D8P, FPC2.0
BeitragVerfasst: Di 29.11.05 13:15 
Hi,

Einrückung is nicht vorhanden, var brauchste nur ein mal schreiben, nicht in jeder Zeile und ich wüsste noch gerne, warum du f als extended hast obwohl sowieso nur integer benutzt werden?!

mfg matze

_________________
si tacuisses, philosophus mansisses.
PattyPur
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 80

Win98, WinXP
Delphi 7
BeitragVerfasst: Di 29.11.05 13:25 
hier rekursiv - ungetestet

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function fak(x:integer):integer;
begin
  if x=1 then 
    result:=1
  else
    result:=fak(x-1)*x;
  end;
end;

_________________
Das Leben ist zum Spielen da,
alles andere ist Unsinn