Display arrays Side by side

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
@Mattle

The only way I know of is like this...
1
2
3
4
5
6
7
8
int arry1[3][4]={0},arry3[3][4]={0};
	string arry2[3][4]={{"a","b","c","d"},{"E","F","G","H"},{"W","x","Y","z"}};
	
	for(int x=0;x<3;x++)
		cout << arry1[x][0] << " " << arry1[x][1] << " " << arry1[x][2] << " " << arry1[x][3]
 << "   " << arry2[x][0] << " " << arry2[x][1] << " " << arry2[x][2] <<" " <<  arry2[x][3]
 << "   " << arry3[x][0] << " " << arry3[x][1] << " " << arry3[x][2] << " " << arry3[x][3] 
<< endl;
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.
closed account (4z0M4iN6)
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
@dadabe
Actually, I didn't know what type of arrays Mattle was going to use, so I just showed a couple different types.
closed account (4z0M4iN6)
Mattle, maybe you could tell us also:

Should it be a console program or a GUI application. GUI applications work fine for tables.
Topic archived. No new replies allowed.