Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do i print a table with multidimensional array.

 
Dmitri Makovetskiy
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my array:





board(pieces,drawNull,4);

board(pieces,drawNull,3);


i created a method to print one column:




how can i print one column next to another?
 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not really sure what you're doing with printing lines there ... "_________" for example ... but generally, you'd want to have two nested for loops. The idea is: for each rank, print out the pieces at each file in that rank, then print a new line, then go to then next rank. (Rank = row, file = column.)
 
Dmitri Makovetskiy
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote:I'm not really sure what you're doing with printing lines there ... "_________" for example ... but generally, you'd want to have two nested for loops. The idea is: for each rank, print out the pieces at each file in that rank, then print a new line, then go to then next rank. (Rank = row, file = column.)


i solved the problem

here is my algorithm


and here is my table



thanks for this site , for helping me for the umteenth time
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic