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

Username:   Password: 
 RegisterRegister   
 Put With Line Spaces
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
josh




PostPosted: Sat Feb 14, 2004 6:57 pm   Post subject: Put With Line Spaces

I am a real newbee and I can't figure out what I have to do to my code in order for it to put spaces bewteen my different lines becasue right now it is very hard to read all clumped together.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat Feb 14, 2004 7:27 pm   Post subject: (No subject)

you can use
code:
locate (row, col)

code:
locatexy (x,y)

code:
put ""


the last one there simply draws a blank space, moving the next put statement down one row.
Delos




PostPosted: Sat Feb 14, 2004 8:28 pm   Post subject: (No subject)

code:

put "All sorts of stuff."
put "More sorts of stuff."

delay (1000)
% Pause for a moment of reflection.
cls

put "All sorts of stuff."
put ""
put "More sorts of stuff."

delay (1000)
% Pause for another moment of reflection.
cls

locate (2,1)
% Locate row 2, column 1.
put "All sorts of stuff."

locate (4, 1)
% Drop down to the forth row.
put "More sorts of stuff."

% Pause for yet another moment of reflection.
cls

put "All sorts of stuff."
put skip
% Skip some lines...whitespace...its complicated...but yeah.
% It skips lines.
put "More sorts of stuff."


Enjoy.
josh




PostPosted: Sat Feb 14, 2004 9:41 pm   Post subject: (No subject)

thanks you guys this makes my program so much easier to understand.
sport




PostPosted: Sun Feb 15, 2004 3:21 pm   Post subject: (No subject)

code:

var number:int:=99
var name:string:="Hello"
put name:7
%will put the name and put 2 more spaces after it (length of name is 5, 7-5=2)
put number:4
%for numbers i will pu spaces before the number. Put two spaces and then 99.
put number:7:2
%will also put 2 decimal spaces
zylum




PostPosted: Sun Feb 15, 2004 3:42 pm   Post subject: (No subject)

or you could just use '\n'

code:

put "blablabla"
put "more blablabla\n"
%new paragraph
put "there is a blank above this line"
put "blablabla"


-zylum
Cervantes




PostPosted: Sun Feb 15, 2004 4:26 pm   Post subject: (No subject)

zylum wrote:
code:

put "blablabla"
put "more blablabla\n"
%new paragraph
put "there is a blank above this line"
put "blablabla"


that doesn't solve the problem quite. He wanted to put an extra space between his lines.

like so

code:

text text text

more text more text


not like so

code:

text text text
more text more text



so for \n to work you'd actually have to put 2 \n 's in there. It saves lines, but it makes your code harder to read. For putting text outside of a loop use put "". For text inside a loop use locate (row, col). If you use the put "" inside a loop it'll continuasly draw the text on a new line which you don't want Eh
apomb




PostPosted: Sun Feb 15, 2004 4:58 pm   Post subject: (No subject)

so all someone could have just told him to use
code:
put " words words words"
put skip
put "more words"

its just turing...not that hard!
Cervantes




PostPosted: Sun Feb 15, 2004 5:00 pm   Post subject: (No subject)

dude.. read the thread Rolling Eyes
that was suggested along with many other methods.... Rolling Eyes
jonos




PostPosted: Sun Feb 15, 2004 5:38 pm   Post subject: (No subject)

or, if you wanted to be really complicated and think about it, you could put just enough spaces extra at the one end of your first line to skip a line and then you wouldn't need an extra put statement Very Happy
zylum




PostPosted: Sun Feb 15, 2004 5:59 pm   Post subject: (No subject)

if you run
code:

put "blablabla"
put "more blablabla\n"
%new paragraph
put "there is a blank above this line"
put "blablabla"


it does leave a space -_-
Andy




PostPosted: Sun Feb 15, 2004 9:22 pm   Post subject: (No subject)

i think this is what u want

code:

drawfill (1, 1, green, blue)
put "blablabla" ..
locate (whatrow + 1, 1)
put "more blablabla" ..
locate (whatrow + 2, 1)
put "there is a blank above this line" ..
locate (whatrow + 1, 1)
put "blablabla" ..

whatrow and whatcol returns the row and col u are currently about to put text on
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  [ 12 Posts ]
Jump to:   


Style:  
Search: