Saturday, January 15, 2011

First problem - Time in Pascal

Today I had my first problem since I started this blog. I didnt know how to get the time in a pascal program I was creating. Eventually I found the answer on Google. There is the GetTime procedure. The only thing it didn't say is that this one uses Dos. So,

Problem: Time in Pascal
Solution: The procedure GetTime with the following declaration:
              procedure GetTime(var Hour, Minutes, Seconds, Centiseconds : word);
              !Don't forget to use Dos!
Example
program first;
uses Dos;
var h,m,s,cs:word;
begin
        gettime(h,m,s,cs);
        writeln(h,' ',m,' ',s,' ',cs);
end.
{this one shows the time)
Good Luck
P.S. If you have a question please don't hesitate to ask!

No comments:

Post a Comment