![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,824
Rep Power: 5
![]() |
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? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,824
Rep Power: 5
![]() |
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? ![]() |
|
|
|
|
|
#3 |
|
Professional Programmer
|
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;} |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,824
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#5 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 639
Rep Power: 4
![]() |
I have to learn Turing for a computer science course.
It wil be quite a dissapointment going from C(++). ![]() |
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,824
Rep Power: 5
![]() |
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. ![]() |
|
|
|
|
|
#7 | |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 639
Rep Power: 4
![]() |
Quote:
![]() |
|
|
|
|
|
|
#8 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,824
Rep Power: 5
![]() |
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. ![]() |
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,824
Rep Power: 5
![]() |
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... -_@ |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|