Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Scripting Languages (http://www.programmingforums.org/forum39.html)
-   -   Object Oriented Turing Help? (http://www.programmingforums.org/showthread.php?t=5727)

Sane Sep 3rd, 2005 10:00 PM

Object Oriented Turing Help?
 
I can't find any documentation, any help, or any tutorials that can answer these simple questions:

How do I retrieve certain parts of a string or integer, how do I convert types, and how can I find the remainder of division?

Sane Sep 3rd, 2005 10:17 PM

1) The equivelent in python is:

print 'Hello'[1:4]
>>> ell
print 'Boo'[-3]
>>> B

2) So what? Should I just go:
var new : int := old

3) but isn't % the comment sign?



EDIT: Wowzor...where'd your post go? :rolleyes:

iignotus Sep 3rd, 2005 11:36 PM

It was completely wrong (I thought) so I removed it.

Sane Sep 3rd, 2005 11:44 PM

Hehe, I didn't know you could remove posts, so I thought it was a glitch. =S

But after much experimentation:
:

put 5 mod 3

will give you 2. Whoppee.

Jessehk Sep 6th, 2005 6:39 PM

I have to learn Turing for a computer science course.

It wil be quite a dissapointment going from C(++). :(

Sane Sep 6th, 2005 9:04 PM

Where do you live by the way? I don't see Turing being a practical high school course language at all...

You will find it very easy though, no worries. ;)

Jessehk Sep 6th, 2005 9:37 PM

Quote:

Originally Posted by Sane
Where do you live by the way? I don't see Turing being a practical high school course language at all...

You will find it very easy though, no worries. ;)

Near Toronto, but I won't go any further off topic. :D

Sane Sep 6th, 2005 9:47 PM

Wow! That would explain it!! Right beside the University of Waterloo too. O_O

Could you PM me your MSN address? We could use eachother as study help for this course. :rolleyes:

Sane Sep 10th, 2005 12:32 PM

Okay. Here it is.

string to integer
:

var x : string := "4"
put strint(x)+2


integer to string
:

var x := 4
put intstr(x)+"2"


retrieving parts of a string
:

put "word"(1)
put "word"(2)
put "word"(3)
put "word"(4)
put "word"(1..4)


That all took a while to figure out... -_@


All times are GMT -5. The time now is 8:18 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC