Computer Science Canada

problem with string

Author:  shoobyman [ Thu Nov 09, 2006 2:43 pm ]
Post subject:  problem with string

code:

for i : 1 .. 3
    locate (i, 1)
    put "^XXXXX^"
end for

this is really wierd, i need the program to output

^XXXXX^
^XXXXX^
^XXXXX^

but it gives an error when i run. it works fine if i get rid of the "^", but i need to have those there, any help?

Author:  DemonZ [ Thu Nov 09, 2006 3:14 pm ]
Post subject: 

I think the problem is not with your program, but with turing. Turing has this annoying little feature that will not let you use certain characters on the keyboard (like ^ or $ and many others) so its not your fault that it wont run, blame turing.

Author:  shoobyman [ Thu Nov 09, 2006 3:46 pm ]
Post subject: 

oh well, it was worth a shot, i'll just get rid of the "^"

Author:  Andy [ Thu Nov 09, 2006 4:31 pm ]
Post subject: 

try \^ instead it should show only the ^

Author:  richcash [ Thu Nov 09, 2006 4:37 pm ]
Post subject: 

You have to use Turing's escape sequence (or something like that!), which is a \.

code:
put "\^"


There is also \t for tab, \n for a new line, \" for a new quotation marks, \\ for a backsplash, and many others.

[edit]Andy, beat me to it, oh well at least I told you some of the other ones..

Author:  shoobyman [ Thu Nov 09, 2006 5:33 pm ]
Post subject: 

thanx everyone, it works


: