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

Username:   Password: 
 RegisterRegister   
 Typecasting in Turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DtY




PostPosted: Wed Apr 22, 2009 7:03 pm   Post subject: Typecasting in Turing

What is it you are trying to achieve?
Convert an integer to a string so I can attach it to a string using +


What is the problem you are having?
I need to set the screen size based on the size of the level loaded, when I add the size using + in setscreen(), I get the error that strings and integers cannot be added together.


Describe what you have tried to solve this problem
* Searched the forum (of course)
* using +, described above
* string(levelWidthPx), which would work in some other languages, told me that string() needed a value known at compile time
* Looked for another function that would take two integers, and only set the screen size.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
None

Please specify what version of Turing you are using
Newest version, 4.1.1, I think.
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Wed Apr 22, 2009 7:21 pm   Post subject: RE:Typecasting in Turing

intstr() . Similarly, realstr(), strreal(), strint(), etc.

Kudos for the excellent problem description, incidentally, that reads much better than the majority of the posts in this forum.
BigBear




PostPosted: Wed Apr 22, 2009 7:26 pm   Post subject: RE:Typecasting in Turing

you can either create a new variable which is assigned to the intstr of the number then add the string to you new variable or make a string varible = intstr of the num + string
DtY




PostPosted: Wed Apr 22, 2009 7:34 pm   Post subject: RE:Typecasting in Turing

Thanks both of you Smile
I will try that tomorrow in class, and I'll post if it doesn't work
BigBear




PostPosted: Wed Apr 22, 2009 8:18 pm   Post subject: RE:Typecasting in Turing

You can use the link at the top of the page to download turing
Dusk Eagle




PostPosted: Wed Apr 22, 2009 10:32 pm   Post subject: Re: Typecasting in Turing

Also check out strintok() and strrealok().
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  [ 6 Posts ]
Jump to:   


Style:  
Search: