Store the data in a structure
struct mys
{
unsigned int x;
unsigned int y;
};
struct mys the_s[10] = {{1, 2}, {3, 4}, {5, 6}, ...};
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
But does that allow me to make it Bydimensional? I cannot see it... I mean:
I cannot print it as I want.
You can make the array as many dimensions as you like but remember that each element contains a structure that has both an int x and a int y. For printing try..Note for the demonstration I'll use a two dimensional example.
std::cout << "x->" << the_s[1][1]->x << " y->" << the_s[1][1]->y << std::endl;
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
To print the table use a nested for statement...one for statement for each dimension.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387