File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How do i print a table with multidimensional array. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do i print a table with multidimensional array." Watch "How do i print a table with multidimensional array." New topic
Author

How do i print a table with multidimensional array.

Dmitri Makovetskiy
Ranch Hand

Joined: Jun 21, 2010
Posts: 128
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

Joined: Oct 01, 2001
Posts: 2840
    
  11

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

Joined: Jun 21, 2010
Posts: 128
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
 
 
subject: How do i print a table with multidimensional array.
 
Similar Threads
MultiDimensional array doesnt work
How do i improve variable visibility?
Help with a chess program
The Crowded Chessboard