Autor Beitrag
pART
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: So 20.01.08 02:42 
hi leute,
ich habe ma ne frage. Ich programmiere gerade mit Turbo Pascal und wollte das im Abstand von etwa einer Sekunde die Zahlen von 0-3 rückwärts ablaufen. So zu sagen ein Countdown. Was muss ich dafür machen ?

Vielen Dank schon mal im vorraus.
MFG

pART
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: So 20.01.08 03:19 
Probier mal:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for i := 3 downto 0 do
  begin
    writeln(i);
    sleep(1000);
  end;

_________________
Hallo Mutti
pART Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: So 20.01.08 15:52 
Hi danke für die schnelle Antwort, da ich aber totaler Anfänger bin, weiss ich nicht wo ich diesen Quelltxt einfügen muss. Könnt ihr mir mal bitte den ganzen Text geben ?

Danke
Niklas
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: So 20.01.08 16:10 

_________________
Hallo Mutti
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: So 20.01.08 20:46 
Du programmierst gerade mit Turbo Pacal, hast schon ein Programm geschrieben, das noch einen Countdown braucht, und weißt jetzt nicht, wo er reinsoll? Das hört sich sehr komisch an :roll:

Der Countdown soll doch genau da rein, wo du ihn haben willst, oder? Als einfachste Version würde wohl diese in Frage kommen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
program Countdown
var i: Integer;
begin
  for i := 3 downto 0 do
  begin
    writeln(i);
    sleep(1000);
  end;
end.

Du definierst zuerst die Variable i, und fügst dann im Hauptprogramm den Countdown ein. Natürlich sollte noch der restliche Code davor und danach.
oldmax
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 380


D3 Prof, D4 Prof
BeitragVerfasst: Mo 21.01.08 13:05 
Hi
Soweit ich's noch in Erinnerung habe, wenn ein CountDown in TP laufen, das Programm aber nicht einfrieren soll, muß man die Idle bemühen und dort die Zeit auswerten. Ist ähnlich einem Timer in Delphi.
Timer = Zeitinterupt
Idle = Procedure in der Programmschleife
Ich hoffe, ich hab's getroffen, es ist schon verdammt lang her....
Gruß oldmax

_________________
Zier dich nich so, ich krieg dich schon....