Printing elements in a table downwards, not left to right
Thu, Aug 25, 2011
I was making a dynamic phone list to be printed around the office, and came across the small problem that I wanted it to print the names in 3 columns with the names listing downwards alphabetically, or as such:
| NAME | NAME | NAME |
| Andrew | Ben | James |
| Anthony | Chris | Kevin |
So I had extrapolated the data from our database into an array.
So to print it, I’m printing the 3 columns at a time, but for each n-th row, printing the n-th element, then the n-th + ceiling of the difference element, then n-th + 2*ceiling of the difference element, and looping through this for loop “difference” amount of times.
No related posts.



Leave a Reply