Mar 2, 2010 at 10:05pm UTC
you know I think your looking at it backwards Disch:
if you do this with standard arrays:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include <iostream>
using namespace std;
int main()
{
int a[4][7];
int counter=0;
for (int i=0; i<4; i++)
{
for (int j=0; j<7; j++)
a[i][j] = ++counter;
counter=0;
}
for (int y=0; y<4; y++)
{
for (int x=0; x<7; x++)
cout << a[y][x];
cout << endl;
}
for (int q=0; q<7; q++)
{
for (int w=0; w<4; w++)
cout << a[q][w];
cout << endl;
}
return 0;
}
1234567
1234567
1234567
1234567
1234
1234
1234
1234.......gibberish
It's most definitely: row/height/y ( * ) col/width/x
Last edited on Mar 2, 2010 at 11:33pm UTC
Mar 2, 2010 at 11:38pm UTC
That's just because multidimentional arrays are backwards (yet another reason they're evil).
Everywhere in mathematics where 2D cartesian coordinates are used, it's pretty much always (x,y).
So yeah... if you're used to doing everything backwards (as MD arrays force you to), then doing things the normal way will seem backwards.
EDIT:
But whatever. It's your class for your own use. Write it however you want! ;P
Last edited on Mar 2, 2010 at 11:40pm UTC
Mar 3, 2010 at 12:02am UTC
You guys have completely confused me with all these arrays lol.
Mar 3, 2010 at 12:20am UTC
Oh true, c/java and derivatives are backwards...that's silly
Mar 3, 2010 at 5:02am UTC
it makes sense that they're backwards when you think about how they work (arrays of arrays). The syntax just doesn't play ball with the "normal" (x,y) approach.
But that's the beauty of a class like this. You can do it however you want.