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

Username:   Password: 
 RegisterRegister   
 VERY SIMPLE PUT PROBLEM
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Boarder16




PostPosted: Mon Jan 12, 2004 3:31 pm   Post subject: VERY SIMPLE PUT PROBLEM

Hey this is a seperate project(not skewl related) i am workign on... i made a veriable(string) and i give it a value with LOTS of text... i want it to show like this when icall it to put...

balance 564
subtraction 34
balance 520

so on... i jsut want to know is when igive th variable a text value do i HAVE to put it like this....

text:= "balance 564 subtraction 34 balance 520"
where there are lots of spaces so it shwos it on teh next line, or is tehre a way ican do sumthign where i type it ut liek this...

put "balance 564
subtraction 34
babalala so on....
and it wil give that value to the variable???
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: Mon Jan 12, 2004 4:03 pm   Post subject: (No subject)

i dont think so...use an array or a variable for each line of text
there might be a way to put an amount of characters from the variable to the string

put (length(word)-10)

that might give you everything but the last characters(MIGHT)
im not positive on that
McKenzie




PostPosted: Mon Jan 12, 2004 4:21 pm   Post subject: (No subject)

% \n is the newline character
put "Hey\nThis\nis\ncool\n"
Boarder16




PostPosted: Mon Jan 12, 2004 4:53 pm   Post subject: (No subject)

holy sh*t i never knew that thanks a lot.. this will save me tones of time..

thanks 8)
DanShadow




PostPosted: Mon Jan 12, 2004 6:51 pm   Post subject: (No subject)

hmm! I thought \n was only used in the 'C' language, lol! tx, Ill probably end up using that if I go back from graphical programming.
Andy




PostPosted: Mon Jan 12, 2004 8:05 pm   Post subject: (No subject)

well turing compiles into C then does work there... but why use that when u have skip?
AsianSensation




PostPosted: Mon Jan 12, 2004 8:06 pm   Post subject: (No subject)

cuz skip and \n are the exact same thing.
Thuged_Out_G




PostPosted: Tue Jan 13, 2004 3:07 pm   Post subject: (No subject)

well, skip has other uses, like when your reading from a file

code:

var stream:int
var line:string

open:stream,"file.txt",get
assert stream>0

loop
get:stream,skip   %skip all whitespace in the document
get:stream,line:*
exit when eof(stream)
end loop
AsianSensation




PostPosted: Tue Jan 13, 2004 5:57 pm   Post subject: (No subject)

not really, when reading from a txt file, unless you did this:

code:
get: filein, word :*


then it would get all the stuff up to any white spaces, and stop there, and I am pretty sure instead of using skip, you can just use '\n' instead.
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  [ 9 Posts ]
Jump to:   


Style:  
Search: