Computer Science Canada

whats wrong with my program?

Author:  timothyleesnipe [ 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

Author:  jr5000pwp [ 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?

Author:  timothyleesnipe [ 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

Author:  jr5000pwp [ 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.

Author:  timothyleesnipe [ 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


: