
过程time是实时汇报时间的。下面主程序就简化为整数加法吧。
只是运行总是不能如愿。我觉得是我对多线程的理解错了,希望有吧友能够帮忙看看怎么解决这类问题。主要是如何在不破坏主程序的情况下,实时汇报时间。
uses dos,windows,crt;
var i,j:integer;
tid:dword;
year,month,date,dow,hour,minute,second,hs:word;
procedure time;
begin
repeat
getdate(year,month,date,dow);
gettime(hour,minute,second,hs);
gotoxy(1,1);
writeln(year,' ',month,' ',date);
gotoxy(1,2);
writeln(hour,' ',minute,' ',second);
delay(1000);
until false;
end;
begin
clrscr;
createthread(nil,0,@time,nil,0,tid);
gotoxy(1,5);
write(1000+100);
end.
只是运行总是不能如愿。我觉得是我对多线程的理解错了,希望有吧友能够帮忙看看怎么解决这类问题。主要是如何在不破坏主程序的情况下,实时汇报时间。
uses dos,windows,crt;
var i,j:integer;
tid:dword;
year,month,date,dow,hour,minute,second,hs:word;
procedure time;
begin
repeat
getdate(year,month,date,dow);
gettime(hour,minute,second,hs);
gotoxy(1,1);
writeln(year,' ',month,' ',date);
gotoxy(1,2);
writeln(hour,' ',minute,' ',second);
delay(1000);
until false;
end;
begin
clrscr;
createthread(nil,0,@time,nil,0,tid);
gotoxy(1,5);
write(1000+100);
end.
