May 9, 2012 at 9:42am UTC
Hi all I have written a program to output three seperate 2d arrays, however I'm not sure how to output then all side by side.
an example of the output would be:
array 1 array 2 array 3
|_|_|_|_| |_|_|_|_| |_|_|_|_|
|_|_|_|_| |_|_|_|_| |_|_|_|_|
|_|_|_|_| |_|_|_|_| |_|_|_|_|
please if you have any advice on how i could do this i would appreciate it.
Last edited on May 9, 2012 at 10:43am UTC
May 9, 2012 at 12:47pm UTC
There are three options (that come to mind at the momment):
1. You can display the first row of each array, and then the second row of each array, etc..
2. You can write to some buffer and then dump that buffer to the console.
3. You can use a library like ncurses to let you draw them on the screen by moving the cursor.
May 9, 2012 at 1:03pm UTC
I see, you have 2 int arrays and one string array.
Having only one kind of arrays, would make it simpler.
Maybe you could tell us something more:
- should it be strings or only be chars
- should it be int or only digits 0 to 9
May 9, 2012 at 2:21pm UTC
@dadabe
Actually, I didn't know what type of arrays Mattle was going to use, so I just showed a couple different types.
May 9, 2012 at 2:32pm UTC
Mattle, maybe you could tell us also:
Should it be a console program or a GUI application. GUI applications work fine for tables.