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

Username:   Password: 
 RegisterRegister   
 I cant get my program to work properly
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
slider203




PostPosted: Sun May 24, 2009 3:45 pm   Post subject: I cant get my program to work properly

Hello could anyone please help me to figure out what is wrong with my code anyhelp woild be greatly appreciated.

const start:= "10"
const finish:= "1"
for decreasing count: start .. finish
put 12 div count
end for

I cant make it run and im not sure why

Thanks very much
Sponsor
Sponsor
Sponsor
sponsor
Dusk Eagle




PostPosted: Sun May 24, 2009 3:57 pm   Post subject: Re: I cant get my program to work properly

First, please use syntax tags, like this:
code:
[syntax="turing"]
%%code here
[/syntax]


As for your problem, do you know what type of value your constants are (i.e. are they strings? or integers?). By declaring their type, you can be sure what type they are. Like this:
Turing:

const x : int := 10

By putting quotation marks around the value of your variables, you have inadvertently made them strings, which is why your program will not run.
zero-impact




PostPosted: Sun May 24, 2009 4:37 pm   Post subject: RE:I cant get my program to work properly

This is because for loops only work when you give them integers.
Kharybdis




PostPosted: Sun May 24, 2009 5:36 pm   Post subject: Re: I cant get my program to work properly

Turing:
const start:= "10"
const finish:= "1"
for decreasing count: start .. finish
put 12 div count
end for


Should be ...


Turing:
const start := "10"
const finish := "1"
for decreasing count : strint (start) .. strint (finish)
    put 12 div count
end for
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  [ 4 Posts ]
Jump to:   


Style:  
Search: