Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Olympic countdown help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zhibo8_r7




PostPosted: 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 ?
Sponsor
Sponsor
Sponsor
sponsor
S_Grimm




PostPosted: 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.
zhibo8_r7




PostPosted: 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?
jernst




PostPosted: 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.
isaiahk9




PostPosted: 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
[Gandalf]




PostPosted: 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.
zhibo8_r7




PostPosted: 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?
isaiahk9




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: