Pascal Chronometer
Sup guys.. I'm following some videoclasses of Pascal, and one of the exercices is to make a chronometer.. I'm making it using Free Pascal...
And here is my code..
The problem is when it passes 1 min, the sec start counting again badly.. Here's the example:
It counts the seconds in the first number of the seconds, but it should happen in the second...
How can i fiz that??
Thanks..
PS.: I'm sorry if i posted in the wrong section... i haven't found a section for Pascal...
And here is my code..
Code:
program chronometer;
uses crt;
var hour,min,sec: integer;
begin
clrscr;
hour:=00
min:=00
sec:=00
while keypressed = false do
while sec=60 = false do
begin
delay(1000);
inc(sec);
gotoxy(20,20);
write(hour,':',min,':',sec);
if sec = 60 then
begin
sec:=00;
min:= min+1;
gotoxy(20,20);
write(hour,':',min,':',sec);
if min = 60 then
begin
min:=00;
hour:= hour+1;
gotoxy(20,20);
write(hour,':',min,':',sec);
end;
end;
end.
Code:
0:0:59 0:1:00 0:1:10 0:1:20 0:1:30 0:1:40 0:1:50 0:1:60 0:1:70 0:1:80 0:1:90 0:1:10 . . .
How can i fiz that??
Thanks..
PS.: I'm sorry if i posted in the wrong section... i haven't found a section for Pascal...