Olympic countdown help
Author |
Message |
zhibo8_r7
|
Posted: Tue May 06, 2008 10:41 am Post subject: Olympic countdown help |
|
|
I want to use Turing to write a program that tells you how many days, hours, minutes and seconds remain until the Beijing Olympic Games begin, but I don't know how to do it, can some one help me ? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
S_Grimm
![](http://compsci.ca/v3/uploads/user_avatars/18926424384e6d86e5cf4d6.jpg)
|
Posted: Tue May 06, 2008 10:44 am Post subject: RE:wanna a help |
|
|
I don't mean to be rude, but didn't you read the threads saying don't post "I need help" titles. And you'd need to know the exact day, month, hour, and second that the Olympics would start. |
|
|
|
|
![](images/spacer.gif) |
zhibo8_r7
|
Posted: Tue May 06, 2008 10:46 am Post subject: RE:wanna a help |
|
|
the exact day ,hours, minutes and seconds I know that ,it is 2008 Aug 08,08:08:08 in +8 Time Zone, but how to make a countdown? |
|
|
|
|
![](images/spacer.gif) |
jernst
![](http://compsci.ca/v3/uploads/user_avatars/72209151847d1934cdf8ad.jpg)
|
Posted: Tue May 06, 2008 1:45 pm Post subject: Re: wanna a help |
|
|
I don't know what it would be in Turing but you would want to search for some kind of getTime() function or something similar. One way you could do it then is get the time over and over again in a loop, and find the difference between the current time and the time of the olympics and display it on the screen. |
|
|
|
|
![](images/spacer.gif) |
isaiahk9
![](http://compsci.ca/v3/uploads/user_avatars/1465120414488e669e1f83a.jpg)
|
Posted: Fri May 09, 2008 3:28 pm Post subject: RE:wanna a help |
|
|
i agree with jernst, but if that didn't work, I would set a timer like this sorta :
var days, hours, minutes, seconds : int
%initiate these variables for when you first run this program
seconds := seconds - 1
if seconds = 0 then
seconds := 60
minutes := minutes - 1
emd if
%do that for minutes to hours and hours to days
If you could connect this with what jernst was saying then it would work, so you don't initiate the time variables, your computer does |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Fri May 09, 2008 4:16 pm Post subject: RE:wanna a help |
|
|
Turing has plenty of time functions:
Time.Elapsed
Time.Sec
Time.Date
time ( var t : string )
clock (var c : int)
And a few others. Use the F9 help in Turing if you are having trouble using these.
However, for the problem at hand you also have to use some math on each element of the time... Let's say the date of the Olympics is 2008/12/15:
Subtract months:
12 - 5 (current month) = 7
Subtract days:
15 - 9 (current day) = 6
The Olympics will therefore be in 7 months and 6 days. This method gets a bit more complicated when the year changes and with things like leap years, but the idea is similar.
*edit* Topic renamed as well. |
|
|
|
|
![](images/spacer.gif) |
zhibo8_r7
|
Posted: Thu May 15, 2008 10:43 am Post subject: RE:Olympic countdown help |
|
|
but how to input the current time in it and make the countdown? |
|
|
|
|
![](images/spacer.gif) |
isaiahk9
![](http://compsci.ca/v3/uploads/user_avatars/1465120414488e669e1f83a.jpg)
|
Posted: Tue May 20, 2008 4:15 pm Post subject: RE:Olympic countdown help |
|
|
Can't you access your computer's clock. F10 it. And why would you want a count down to the second of the Olympics? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|