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

Username:   Password: 
 RegisterRegister   
 whats wrong with my program?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
timothyleesnipe




PostPosted: Wed Jun 05, 2013 9:43 am   Post subject: whats wrong with my program?

I dont understand what is wrong with our program, the loop does not execute. the timer continmues ticking and the "alarm" doesnt go off. what can i do to fix this?


var code : string
get code : 8

loop

put Time.Date
Time.DelaySinceLast (1000)
cls

put "the alarm is set for " + code

if Time.Date = code then

put "wake up"
(here i would input a sound file as well)
end if
Sponsor
Sponsor
Sponsor
sponsor
jr5000pwp




PostPosted: Wed Jun 05, 2013 11:43 am   Post subject: RE:whats wrong with my program?

Compare your code variable to what is being written by Time.Date, what is the difference? They have to be exact matches for the if statement to be triggered, what can you do to make them match?
timothyleesnipe




PostPosted: Thu Jun 06, 2013 9:13 am   Post subject: Re: whats wrong with my program?

changing the variable type? i tried putting this instead but it wouldnt work either Sad

var code : string (do i need an interger?)
get code : 8

loop

put Time.Date
Time.DelaySinceLast (1000)
cls

put "the alarm is set for " + code

if Time.DelaySinceLast (1000) = code then

put "wake up"

end if
jr5000pwp




PostPosted: Thu Jun 06, 2013 9:54 am   Post subject: RE:whats wrong with my program?

Firstly you shouldn't be comparing Time.DelaySinceLast(1000) to your variable. Secondly, you should take a look at this page here:
http://compsci.ca/holtsoft/doc/time_date.html
Pay special attention to what each variable is being set to and try and figure out which one matches your input accurately.
timothyleesnipe




PostPosted: Mon Jun 10, 2013 9:52 am   Post subject: Re: whats wrong with my program?

thanks man i got it!

all i added was

var Time.Date : string
get Time.Date : 8
var code : string
get code : 8
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  [ 5 Posts ]
Jump to:   


Style:  
Search: