this is exam for meCode:program codecall; var i,n,m,j:integer; begin write('hour ? : '); readln(n); write('minutes ? : '); readln(m); if (n>=0) and (n<=24) and (m>=0) and (m<=60) then for i:=1 to m do for j:=1 to n do begin if m mod 5 = 0 then writeln('now is ',n,' hour and ',m,' mins !') else m:=m+1; end; readln; end.
after 5 mins write " now is X hour and Y mins"
my program not work corectly. :S
i need help.
thanks in advance![]()
Have you considered using the sleep function?
I dont know how to use this function :S
Can anybody explain me ?
:S
No help for me ?
OK, first problem: you aren't using the now() function to find out when 5 minutes have passed.
Doing it brute force: you would need to get the current time when the program starts.
Then you would need to calculate when 5 minutes later would be.
Then you would need to wait (using a while loop or something) until now() returns a time later than 5 minutes after the program started.
Then you can output the hour/minute component of that time.
i dont know how to convert minutes in hour.
60 mins = 1 hour and i dont know this part/step in my code :S
any idea ?
ok, i find one code, i think that this code will help me to finished my program
hier is code
can anybody explain me this code ? PLEASECode:function timer:real; var hour,minute,second,sec100:word; begin gettime(hour,minute,second,sec100); timer:=(hour*3600.0+minute*60.0+second)*100.0+1.0*sec100; end; procedure wait_seconds(t:real); var t1:real; begin t1:=timer; repeat until timer>t1+100*t; end;
step by step
thank you in advance
timer returns the number of hundredths of a second since midnight.
wait_seconds sits in a loop until the specified number of seconds have passed.
ok. i like to make program who will write on screen hour, mins and seconds. for example
input >
1 hour 4 mins
output >
1 hour 9 mins
after 5 mins
now 1 o'clock 14 mins
........
..........
4 o'clock and 2 mins
after 5 mins
4 o'clock and 7 mins
i dont know how to make TIME REMAINING :S
that is my problem
please for help
I'm not sure if you're having problem with the decodetime function, or something else.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks