Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 3rd, 2005, 10:00 PM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,824
Rep Power: 5 Sane will become famous soon enough
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 is offline   Reply With Quote
Old Sep 3rd, 2005, 10:17 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,824
Rep Power: 5 Sane will become famous soon enough
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?
Sane is offline   Reply With Quote
Old Sep 3rd, 2005, 11:36 PM   #3
iignotus
Professional Programmer
 
iignotus's Avatar
 
Join Date: Apr 2005
Location: Nowhere Special
Posts: 466
Rep Power: 4 iignotus is on a distinguished road
Send a message via AIM to iignotus
It was completely wrong (I thought) so I removed it.
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[ 
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;}
iignotus is offline   Reply With Quote
Old Sep 3rd, 2005, 11:44 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,824
Rep Power: 5 Sane will become famous soon enough
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.
Sane is offline   Reply With Quote
Old Sep 6th, 2005, 6:39 PM   #5
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 639
Rep Power: 4 Jessehk is on a distinguished road
I have to learn Turing for a computer science course.

It wil be quite a dissapointment going from C(++).
Jessehk is offline   Reply With Quote
Old Sep 6th, 2005, 9:04 PM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,824
Rep Power: 5 Sane will become famous soon enough
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.
Sane is offline   Reply With Quote
Old Sep 6th, 2005, 9:37 PM   #7
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 639
Rep Power: 4 Jessehk is on a distinguished road
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.
Jessehk is offline   Reply With Quote
Old Sep 6th, 2005, 9:47 PM   #8
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,824
Rep Power: 5 Sane will become famous soon enough
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.
Sane is offline   Reply With Quote
Old Sep 10th, 2005, 12:32 PM   #9
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,824
Rep Power: 5 Sane will become famous soon enough
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... -_@
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:38 AM.

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