Computer Science Canada

How do I make columns in a table align?

Author:  dampflames [ Wed Sep 15, 2004 3:48 pm ]
Post subject:  How do I make columns in a table align?

I'm a total beginner, and I tried to find a tutorial on this... So, how can I make columns align? Without using the "locate" command or anything.

Author:  Dan [ Wed Sep 15, 2004 4:12 pm ]
Post subject: 

If you are just using simple text then i whoul use tabs. If u put a \t in a string it will act as a tab and alow u to do better spacing for a table:

code:

put "1\t2\t3\t4\t5"
put "Dan\tTony\tMazer\tHomer\toctopi"
put "Dark\tBlade\tDelta\tAsian\tdodge"
put "naoki\trizzix\tmailer\tDanS.\tshorthair"
put "wtd\tCervantes"


Only problem is if the text is to long and gose in to the next cell it will push everything over. To solve that i whould use 2 '\t's rather then one.

Author:  dampflames [ Wed Sep 15, 2004 8:14 pm ]
Post subject: 

Hacker Dan wrote:
If you are just using simple text then i whoul use tabs. If u put a \t in a string it will act as a tab and alow u to do better spacing for a table:

code:

put "1\t2\t3\t4\t5"
put "Dan\tTony\tMazer\tHomer\toctopi"
put "Dark\tBlade\tDelta\tAsian\tdodge"
put "naoki\trizzix\tmailer\tDanS.\tshorthair"
put "wtd\tCervantes"


Only problem is if the text is to long and gose in to the next cell it will push everything over. To solve that i whould use 2 '\t's rather then one.


But 3 wouldn't be aligned "to the right" over Mazer and Delta beneath it, would it?

Author:  Cervantes [ Wed Sep 15, 2004 8:38 pm ]
Post subject: 

if you put the extra \t everywhere except where the text is longer than one tab space, such as my name in Dan's example, everything will work fine.

code:

put "1\t\t2\t\t3\t\t4\t\t5"
put "Dan\t\tTony\t\tMazer\t\tHomer\t\toctopi"
put "Dark\t\tBlade\t\tDelta\t\tAsian\t\tdodge"
put "naoki\t\trizzix\t\tmailer\t\tDanS.\t\tshorthair"
put "wtd\t\tCervantes\tdampflames\tCatalyst\tPaul Bian"

Author:  Andy [ Thu Sep 16, 2004 3:44 pm ]
Post subject: 

use this

code:

put "1":5,"10":5
put "2":5,"20":5
put "3":5,"30":5
put "4":5,"40":5


but do keep in mind that strings are left aligned and numbers are right aligned

Author:  Artermis [ Fri Sep 24, 2004 9:35 pm ]
Post subject: 

Can someone please help this code? I'm trying to get it to align as well, but the tab doesn't work on my for... put... line... yeah... help!!

code:
put "Please input the number of terms you want."
get NumNumbers

put"",skip

put "Please input the number you want to start from."
get StartNumber

put "",skip

put "NumberSquare\tCubet\tSquare Root\tCube Root" %this aligns pretty well

for k:StartNumber..StartNumber+NumNumbers-1

    put k:4,Square(k):12,Cube(k):12,SquareRoot(k):15:3,CubeRoot(k):15:3 %HERE IS WHERE I NEED IT TO ALIGN I CAN'T GET TABS TO WORK!!

end for

Author:  AsianSensation [ Fri Sep 24, 2004 10:43 pm ]
Post subject: 

well, you are suppose to play around with the values to see which makes your columns the best looking ones.

so something like this:

code:
    put k : 6, k * 2 : 15, k * k * k : 12, sqrt (k) : 15 : 3 %HERE IS WHERE I NEED IT TO ALIGN I CAN'T GET TABS TO WORK!!


Though normally, you can just count the letters "NumberSquare\tCubet\tSquare Root\tCube Root", like NumberSquare is 12 letters long, you want the number to appear in the middle, so you would do something like indenting 6 spaces.

If you are really meticulous, you could always match up the middle of the number to the middle of the word, and that would involve some arithmetics.


: